Mojoliciousでログの書式を変更する

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sub startup {
  my $app = shift;
  $app->log->format(sub {
    my ($time, $level, @lines) = @_;
    my $time_string = localtime($time);
    my @caller = caller(4);
    my $caller = join ' ', $caller[0], $caller[2];
    return "[$time_string] [$level] [$caller] @lines\n";
  });
  my $r = $app->routes;
  $r->get('/')->to('index#start');
}
comments powered by Disqus
Built with Hugo
テーマ StackJimmy によって設計されています。