small fixes
This commit is contained in:
parent
262253d670
commit
56215cf0d3
2 changed files with 12 additions and 12 deletions
|
@ -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!' }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue