Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper logger to consumer and handlers #78

Merged
merged 1 commit into from
Feb 16, 2024
Merged

Add proper logger to consumer and handlers #78

merged 1 commit into from
Feb 16, 2024

Conversation

theory
Copy link
Member

@theory theory commented Feb 16, 2024

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.

@theory theory self-assigned this Feb 16, 2024
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.
@theory theory merged commit c9d5255 into main Feb 16, 2024
10 checks passed
@theory theory deleted the consumer-log branch February 16, 2024 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant