The logs display information by default. Using the _default function in Mojo::Log.
sub _default {
my ($time, $level) = (shift, shift);
my ($s, $m, $h, $day, $month, $year) = localtime $time;
$time = sprintf '%04d-%02d-%02d %02d:%02d:%08.5f', $year + 1900, $month + 1, $day, $h, $m,
"$s." . ((split /\./, $time)[1] // 0);
return "[$time] [$$] [$level] " . join "\n", @_, '';
}
It is necessary to add information about the current user (for example, his ID). An App :: Controller object is required to retrieve user information. Is it possible to override the resulting $app->log using the before_dispatch function?
$app->hook(before_dispatch => sub($c){...});