Skip to content

Commit

Permalink
shorten the level indicator too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 6, 2018
1 parent 756b3cf commit b788beb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Log.pm
Expand Up @@ -72,7 +72,7 @@ sub _message {

sub _short {
my ($time, $level) = (shift, shift);
return "<$MAGIC{$level}>[$level] " . join "\n", @_, '';
return "<$MAGIC{$level}>[" . substr($level, 0, 1) . '] ' . join "\n", @_, '';
}

1;
Expand Down
16 changes: 8 additions & 8 deletions t/mojo/log.t
Expand Up @@ -61,16 +61,16 @@ like $log->format->(time, 'debug', qw(Test 1 2 3)), qr/^debug:\d+:Test:1:2:3$/,
ok $log->short, 'short messages';
$log = Mojo::Log->new(short => 1);
ok $log->short, 'short messages';
like $log->format->(time, 'debug', 'Test 123'),
qr/^<7>\[debug\] Test 123\n$/, 'right format';
like $log->format->(time, 'info', 'Test 123'), qr/^<6>\[info\] Test 123\n$/,
like $log->format->(time, 'debug', 'Test 123'), qr/^<7>\[d\] Test 123\n$/,
'right format';
like $log->format->(time, 'info', 'Test 123'), qr/^<6>\[i\] Test 123\n$/,
'right format';
like $log->format->(time, 'warn', 'Test 123'), qr/^<4>\[w\] Test 123\n$/,
'right format';
like $log->format->(time, 'error', 'Test 123'), qr/^<3>\[e\] Test 123\n$/,
'right format';
like $log->format->(time, 'warn', 'Test 123'), qr/^<4>\[warn\] Test 123\n$/,
like $log->format->(time, 'fatal', 'Test 123'), qr/^<2>\[f\] Test 123\n$/,
'right format';
like $log->format->(time, 'error', 'Test 123'),
qr/^<3>\[error\] Test 123\n$/, 'right format';
like $log->format->(time, 'fatal', 'Test 123'),
qr/^<2>\[fatal\] Test 123\n$/, 'right format';
}

# Events
Expand Down

0 comments on commit b788beb

Please sign in to comment.