Skip to content

Commit

Permalink
fix initialization of logger when level variable is undef
Browse files Browse the repository at this point in the history
  • Loading branch information
hannaeko committed May 12, 2022
1 parent efc4e78 commit 6ff641b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Zonemaster/Backend/Log.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ my $trace_level = Log::Any::Adapter::Util::numeric_level('trace');
sub init {
my ($self) = @_;

if ( exists $self->{log_level} && $self->{log_level} =~ /\D/ ) {
if ( defined $self->{log_level} && $self->{log_level} =~ /\D/ ) {
$self->{log_level} = lc $self->{log_level};
my $numeric_level = Log::Any::Adapter::Util::numeric_level( $self->{log_level} );
if ( !defined($numeric_level) ) {
croak "Error: Unrecognized log level " . $self->{log_level} . "\n";
Expand Down
2 changes: 1 addition & 1 deletion script/zonemaster_backend_rpcapi.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local $| = 1;

Log::Any::Adapter->set(
'+Zonemaster::Backend::Log',
log_level => lc $ENV{ZM_BACKEND_RPCAPI_LOGLEVEL},
log_level => $ENV{ZM_BACKEND_RPCAPI_LOGLEVEL},
json => $ENV{ZM_BACKEND_RPCAPI_LOGJSON},
stderr => 1
);
Expand Down

0 comments on commit 6ff641b

Please sign in to comment.