use Log::Defer;
use JSON::XS; ## or whatever
use Try::Tiny;
sub my_logger_function {
my $msg = shift;
my $encoded_msg = try {
JSON::XS->new->pretty(1)->encod
e($msg)
}
catch {
"Failed to JSON encode msg : $_"
};
print $encoded_msg; ## usually you'd append this to a file
}
my $logger = Log::Defer->new({
isualisation tool L<log-defer-viz> only support JSON at this time.
The currently recommended format to store logs in is newline-separated, minified JSON. The newline+minification is useful because it