Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log::Any::Adapter::Multiplex doesn't print structured data to adapter #83

Open
jenzajon opened this issue Feb 2, 2021 · 1 comment
Open

Comments

@jenzajon
Copy link

jenzajon commented Feb 2, 2021

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.

@jenzajon
Copy link
Author

jenzajon commented Feb 2, 2021

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant