Open jenzajon opened 3 years ago
Example showing incorrect behavior:
#!perl
use strict;
use warnings;
use Log::Any qw( $log );
use Log::Any::Adapter;
use Log::Any::Adapter::Stdout;
Log::Any::Adapter->set( 'Multiplex', adapters => { 'Stdout' => [ log_level => 'debug' ] } );
$log->info( 'record: ', { id_no => 123456 } );
exit;
Incorrect behavior result:
record:
Example showing expected Stdout behavior:
#!perl
use strict;
use warnings;
use Log::Any qw( $log );
use Log::Any::Adapter;
use Log::Any::Adapter::Stdout;
Log::Any::Adapter->set( 'Stdout', log_level => 'info' );
$log->info( 'record: ', { id_no => 123456 } );
exit;
Result:
record: {id_no => 123456}
When logging structured data, Log::Any::Adapter::Multiplex's "structured" subroutine will use "_unstructured_log_args" to create an arrayref of the message and the stringified structured data. But, an adapter like Log::Any::Adapter::Stdout will only grab the first element as the $text. Comparing Log::Any::Adapter::Multiplex and Log::Any::Proxy, it looks like there needs to be a join with spaces in "structured" before passing on to the adapter's subroutine.