erlang-lager / lager

A logging framework for Erlang/OTP
Apache License 2.0
1.12k stars 455 forks source link

Fix logger:remove_handler() error check #573

Closed firx closed 1 year ago

firx commented 1 year ago

It seems, from https://github.com/erlang-lager/lager/commit/9f8d7a705ef5e2e263f1b1b549ec8ba4d3f59a36 that the intent is to avoid logging an error when the default handler has already been removed, but the value it checks for is incorrect and can't ever be returned.

Erlang's logger:remove_handler() doesn't define a specific value in this case (or any case) but from the source it's clear that it will always be error:{badmatch, {error, {badmatch, }}} for the case where a handler isn't found, so look instead for this value.

This prevents a spurious error from being logged on every startup.

firx commented 1 year ago

Ah, I misunderstood something.