-
Notifications
You must be signed in to change notification settings - Fork 19
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
Format string methods return undef #64
Comments
#Sorry, this issue was dublicate #53 |
No, this is a different problem to #53. This is the formatting methods not returning anything at all, which is a bug. |
From the other thread:
|
Your code completely bypasses the As for So, I'm going to need more information about the bug, including a reproduction case or a failing test. |
In these tests there is Log::Any::Adapter 'Test'. I use logging in libraries through the following code: confess $log->errorf( .. ); I have exceptions without description, when program not set Log::Any::Adapter. My solution does not restrict $self->{formatter}, it fix the issue. Example problem code #!/usr/bin/perl
use Log::Any qw($log);
printf "-%s-", $log->infof("ran sub"); Test $ cat t/proxy-#64.t
use strict;
use warnings;
use Test::More;
use Log::Any qw( $log );
plan tests => 1;
my $out = $log->infof("ran sub");
is $out, 'ran sub', 'log message built is returned';
$ prove t/proxy-#64.t
t/proxy-#64.t .. 1/1
# Failed test 'log message built is returned'
# at t/proxy-#64.t line 10.
# got: undef
# expected: 'ran sub'
# Looks like you failed 1 test of 1.
t/proxy-#64.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests |
Your code goes into the It looks like the problem is because Log::Any::Proxy wasn't correctly returning the formatted log string in the case where the log level of the adapter is higher than the current log message. This is always the case when using the Null adapter. I've added a couple tests and made sure that if someone is using the return value from the log method, it is returned. Thanks for the report and the help reproducing! This is fixed in v1.703. |
Format string methods return undef
The text was updated successfully, but these errors were encountered: