# temporarily redirect arrays of [ $level, $category, $message ] into an array Log::Any::Adapter->set( { lexically => \my $scope }, Capture => to => \my @array ); # temporarily redirect just the text of log messages into an array Log::Any::Adapter->set( { lexically => \my $scope }, Capture => text => \my @array ); # temporarily redirect the full argument list and context of each call, but only for # log levels 'info' and above. Log::Any::Adapter->set( { lexically => \my $scope }, Capture => format => 'structured', to => \my @array, log_level => 'info' );
sub ( $level, $category, $message_text ) { ... } push @to, [ $level, $category, $message_text ];
This is the default format. It passes/pushes 3 arguments: the name of the log level, the logging category, and the message text as a plain string.
sub ( $message_text ) { ... } push @to, $message_text;
This format is the simplest, and only passes/pushes the text of the message.
sub ( $level, $category, @message_parts, \%context? ) { ... } push @to, [ $level, $category, @message_parts, \%context? ];
This passes/pushes the full information available about the call to the logging method. The @message_parts are the actual arguments passed to the logging method, and if the final argument is a hashref, it is the combined "context" from the logging proxy and any overrides passed to the logging method.
text => $dest
is shorthand for
format => 'text', to => $dest
structured => $dest
is shorthand for
format => 'structured', to => $dest
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.