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

Log Handler: Ignore non-error logs #168

Merged
merged 2 commits into from
Aug 4, 2023
Merged

Log Handler: Ignore non-error logs #168

merged 2 commits into from
Aug 4, 2023

Conversation

shalvah
Copy link
Contributor

@shalvah shalvah commented Aug 2, 2023

Part of the fix for honeybadger-io/honeybadger-laravel#105

It turns out that setting the minimum log level isn't enough; the handler has to explicitly check that the record passes.

Related:

@shalvah shalvah changed the title Ignore non-error logs Log Handler: Ignore non-error logs Aug 2, 2023
Copy link
Member

@subzero10 subzero10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A minor non-blocking comment about the test.

@@ -32,6 +32,10 @@ public function __construct(Reporter $honeybadger, int $level = Logger::DEBUG, b
*/
protected function write($record): void
{
if (!$this->isHandling($record)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, this is already built-in so you just had to call it 👌

@subzero10
Copy link
Member

@shalvah I added a changelog entry to trigger the CI tests (I enabled them).

@shalvah shalvah merged commit 7cab9bc into master Aug 4, 2023
@shalvah shalvah deleted the ignore-non-error-logs branch August 4, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants