Add proper logger to consumer and handlers #78
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.