diff --git a/lib/Log/Mini/Logger/Base.pm b/lib/Log/Mini/Logger/Base.pm index 5e69530..94fc96c 100644 --- a/lib/Log/Mini/Logger/Base.pm +++ b/lib/Log/Mini/Logger/Base.pm @@ -13,7 +13,7 @@ my $LEVELS = { warn => 2, info => 3, debug => 4, - trace => 5 + trace => 5, }; sub new @@ -39,7 +39,7 @@ sub set_level $self->{'level'} = $new_level; - return; + return 1; } sub level @@ -71,7 +71,7 @@ sub _log $self->_print($text); - return; + return 1; } sub _print { croak 'Not implemented!' } diff --git a/t/03_LoggerFILE.t b/t/03_LoggerFILE.t index 142ab48..610d0dd 100644 --- a/t/03_LoggerFILE.t +++ b/t/03_LoggerFILE.t @@ -14,9 +14,9 @@ subtest 'creates correct object' => sub { subtest 'prints to file' => sub { - for my $level (qw/error warn debug/) { + for my $level (qw/error warn info debug trace/) { my $file = File::Temp->new; - my $log = _build_logger(file => $file->filename); + my $log = _build_logger(file => $file->filename, level => $level); $log->$level('message'); undef $log; @@ -31,7 +31,8 @@ subtest 'prints to file synced' => sub { my $file = File::Temp->new; my $log = _build_logger(file => $file->filename, synced => 1); - for my $level (qw/error warn debug/) { + for my $level (qw/error warn info debug trace /) { + $log->set_level($level); $log->$level('message'); my $content = _slurp($file); @@ -41,10 +42,9 @@ subtest 'prints to file synced' => sub { }; subtest 'prints to stderr with \n' => sub { - for my $level (qw/error warn debug/) { - + for my $level (qw/error warn info debug trace/) { my $file = File::Temp->new; - my $log = _build_logger(file => $file->filename); + my $log = _build_logger(file => $file->filename, level => $level); $log->$level('message'); @@ -57,9 +57,9 @@ subtest 'prints to stderr with \n' => sub { }; subtest 'prints sprintf formatted line' => sub { - for my $level (qw/error warn debug/) { + for my $level (qw/error warn info debug trace/) { my $file = File::Temp->new; - my $log = _build_logger(file => $file->filename); + my $log = _build_logger(file => $file->filename, level => $level); $log->$level('message %s', 'formatted'); @@ -80,7 +80,7 @@ sub _slurp { sub _build_logger { my $logger = Log::Mini::Logger::FILE->new(@_); - $logger->set_level('debug'); + return $logger; }