Is there a way to get Hypnotoad Worker ID inside of Mojo::Log->format(&logFormat) callback function.
I like to add custom “Http Request ID” after Log Level in standard login format.
I managed to change standard format but I like to have Worker ID also just like in standard format.
Any help will be appreciated.
my $log = Mojo::Log->new(path => $logPath, level => 'debug');
$log->format(&logFormat);
sub logFormat {
my ($time, $level, @lines) = @_;
my $now = localtime_to_iso8601_datetime({second_precision => 5}, $time);
$now =~ s/T/ /;
# Http Request ID is sent as last line
my $httpRequestId = pop(@lines);
my $currentWorkerId = "????"; # how to get worker ID to imitate standard log
# [2024-06-13 09:36:06.19863] [?????] [debug] [123456789]
return "n[$now] [$currentWorkerId] [$level] [$httpRequestId] @lines";