pgxn / pgxn-manager

Interface for managing extensions on PGXN
http://pgxn.org
47 stars 18 forks source link

Add proper logger to consumer and handlers #78

Closed theory closed 9 months ago

theory commented 9 months ago

Create (hidden) package PGXN::API::Consumer::Log and set it up with log level as the first argument to its log method, and suppress logging according to verbosity. Teach Consumer to use it, then also teach the Mastodon and Twitter handlers. Add tests to ensure it all works, including time mocking in the Mastodon and Twitter tests.

Note that the handlers no longer throw an error on failure, but simply log it. The Consumer still wraps the handlers in try/catch in order to log any unexpected errors and continue runnnig.

This will mean additional log information from the handlers, in particular, which did no logging previously. Will be helpful when something happens to the consumer and we can see in the log what the last release to be processed was.

While at it, remove unnecessary uses of Carp.