Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Log-Dispatch CPAN distribution.

Report information
The Basics
Id: 106605
Status: resolved
Priority: 0/
Queue: Log-Dispatch

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 2.49



Subject: regression: ::Screen output does not go to stdout with 2.47
This release broke the use of Log::Dispatch::Screen in Dist::Zilla: https://metacpan.org/diff/file?target=DROLSKY%2FLog-Dispatch-2.47%2F&source=DROLSKY%2FLog-Dispatch-2.46%2F Specifically, $zilla->log(...) when used inside Dist::Zilla::App::Tester no longer sends its output to stdout to be captured. Here is the Log::Dispatch object under 2.46, which works: # bless( { # 'outputs' => { # 'self' => bless( { # 'array' => [ # { # 'level' => 'info', # 'message' => 'Foo::Bar', # 'name' => 'self' # } # ], # 'level_names' => [ # 'debug', # 'info', # 'notice', # 'warning', # 'error', # 'critical', # 'alert', # 'emergency' # ], # 'level_numbers' => { # 'alert' => 6, # 'crit' => 5, # 'critical' => 5, # 'debug' => 0, # 'emerg' => 7, # 'emergency' => 7, # 'err' => 4, # 'error' => 4, # 'info' => 1, # 'notice' => 2, # 'warn' => 3, # 'warning' => 3 # }, # 'max_level' => 7, # 'min_level' => 0, # 'name' => 'self' # }, 'Log::Dispatch::Array' ), # 'stdout' => bless( { # 'callbacks' => [ # sub { # package Log::Dispatchouli; # use warnings; # use strict; # my(%arg) = @_; # "$arg{'message'}\n"; # } # ], # 'level_names' => $VAR1->{'outputs'}{'self'}{'level_names'}, # 'level_numbers' => $VAR1->{'outputs'}{'self'}{'level_numbers'}, # 'max_level' => 1, # 'min_level' => 0, # 'name' => 'stdout', # 'stderr' => 0 # }, 'Log::Dispatch::Screen' ) # } # }, 'Log::Dispatch' ) and from the failing path, in 2.47: # here is the LD object: bless( { # 'outputs' => { # 'self' => bless( { # 'array' => [ # { # 'level' => 'info', # 'message' => 'Foo::Bar', # 'name' => 'self' # } # ], # 'level_names' => [ # 'debug', # 'info', # 'notice', # 'warning', # 'error', # 'critical', # 'alert', # 'emergency' # ], # 'level_numbers' => { # 'alert' => 6, # 'crit' => 5, # 'critical' => 5, # 'debug' => 0, # 'emerg' => 7, # 'emergency' => 7, # 'err' => 4, # 'error' => 4, # 'info' => 1, # 'notice' => 2, # 'warn' => 3, # 'warning' => 3 # }, # 'max_level' => 7, # 'min_level' => 0, # 'name' => 'self' # }, 'Log::Dispatch::Array' ), # 'stdout' => bless( { # 'callbacks' => [ # sub { # package Log::Dispatchouli; # use warnings; # use strict; # my(%arg) = @_; # "$arg{'message'}\n"; # } # ], # 'fh' => bless( \*Symbol::GEN2, 'IO::Handle' ), # 'level_names' => $VAR1->{'outputs'}{'self'}{'level_names'}, # 'level_numbers' => $VAR1->{'outputs'}{'self'}{'level_numbers'}, # 'max_level' => 1, # 'min_level' => 0, # 'name' => 'stdout' # }, 'Log::Dispatch::Screen' ) # } # }, 'Log::Dispatch' ) The diff is: # bless( { # 'outputs' => { # 'self' => bless( { @@ -50,13 +55,15 @@ # "$arg{'message'}\n"; # } # ], +# 'fh' => bless( \*Symbol::GEN2, 'IO::Handle' ), # 'level_names' => $VAR1->{'outputs'}{'self'}{'level_names'}, # 'level_numbers' => $VAR1->{'outputs'}{'self'}{'level_numbers'}, # 'max_level' => 1, # 'min_level' => 0, -# 'name' => 'stdout', -# 'stderr' => 0 +# 'name' => 'stdout' # }, 'Log::Dispatch::Screen' ) # } # }, 'Log::Dispatch' ) The Log::Dispatchouli object is being constructed thusly: return Log::Dispatchouli->new({ ident => 'Dist::Zilla', to_stdout => 1, log_pid => 0, to_self => 1, quiet_fatal => 'stdout', });
Here is a self-contained reproduction script, that works on LD 2.46 but fails on LD 2.47: use strict; use warnings; use Test::More; use Test::DZil; use Dist::Zilla::App::Tester; use Path::Tiny; use File::pushd 'pushd'; { package Dist::Zilla::App::Command::ether; use Dist::Zilla::App -command; sub opt_spec { [] } sub execute { my ($self, $opt) = @_; # $arg $self->log('### this is a test!'); return; } } my $tempdir = Path::Tiny->tempdir(CLEANUP => 1); my $root = $tempdir->child('source'); $root->mkpath; my $wd = pushd $root; path($root, 'dist.ini')->spew_utf8( simple_ini() ); my $result = test_dzil('.', [ 'ether' ]); is($result->exit_code, 0, 'dzil would have exited 0'); is($result->error, undef, 'no errors'); is($result->stdout, "### this is a test!\n", 'got stdout'); local $Data::Dumper::Deparse = 1; diag 'here is the LD object: ', explain $result->app->zilla->chrome->logger->dispatcher; if (not Test::Builder->new->is_passing) { diag 'got result: ', explain $result; } done_testing;