Skip Menu |
 

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

Report information
The Basics
Id: 87133
Status: new
Priority: 0/
Queue: Log-Dispatch

People
Owner: Nobody in particular
Requestors: ross.attrill [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.40
Fixed in: (no value)



Subject: Difficult to find source if level not provided
Download (untitled) / with headers
text/plain 685b
If the user fails to provide a level then it can be very hard to work out which line of user's source this has been caused in as Log::Dispatch doesn't handle this. For example user types $log->log(message); they will get a hash element undefined warning (which becomes fatal in some contexts like Dancer) giving the location in Log/Dispatch.pm but not the source line causing the problem. This can become very hard to track down. A small change to the sub level_is_valid to introduce 'croak' should fix this: use Carp qw(croak); ... sub level_is_valid { shift; my $level = shift; croak "Logging level not provided" unless $level; return $LEVELS{ $level }; }
From: ross.attrill [...] gmail.com
Download (untitled) / with headers
text/plain 840b
On Mon Jul 22 00:09:58 2013, uvb wrote: Show quoted text
> If the user fails to provide a level then it can be very hard to work > out which line of user's source this has been caused in as > Log::Dispatch doesn't handle this. > > For example user types > > $log->log(message); > > they will get a hash element undefined warning (which becomes fatal in > some contexts like Dancer) giving the location in Log/Dispatch.pm > but not the source line causing the problem. This can become very > hard to track down. > > A small change to the sub level_is_valid to introduce 'croak' should > fix this: > > > sub level_is_valid { > shift; > my $level = shift; > Carp::croak("Logging level not provided") unless $level; > return $LEVELS{ $level }; > } >
See Pull Request: https://github.com/autarch/Log-Dispatch/pull/3


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.