http://www.perlmonks.org?node_id=1108394


in reply to Re: Test::Trap + Log::Dispatch under Cron
in thread Test::Trap + Log::Dispatch under Cron

Well, the screen output is definitely writing to STDOUT, at least according to Test::Trap.

I've taken an approach similar to Test::Log::Dispatch and added a code output that appends all messages to an array. I'm not getting the logs with Test::Trap anymore, but it's not a complete change to the rest of the testing approach by needing to read a temp logfile.

our @log; $logger->add( Log::Dispatch::Code->new( min_level => 'debug', code => +sub { my %entry = @_; push @log, $entry{message}; }};