X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=cef7ac7be4989384fcde50e97e808fce8304230d;hp=db307ab9bc2477df00b3c95b75a8bcaf7fa01717;hb=5baa3bbcb8bea403665bceaa82f819905f0b501f;hpb=d258fcb2143b861826a4682d3c04c442f0c1ff9f diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index db307ab..cef7ac7 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2226,19 +2226,19 @@ or if the C<$CATALYST_DEBUG> environment variable is set to a true value. Note that if the log has already been setup, by either a previous call to C or by a call such as C<< __PACKAGE__->log( MyLogger->new ) >>, -that this method won't actually set up the log. +that this method won't actually set up the log object. =cut sub setup_log { my ( $class, $levels ) = @_; - my %levels; + $levels ||= ''; + $levels =~ s/^\s+//; + $levels =~ s/\s+$//; + my %levels = map { $_ => 1 } split /\s*,\s*/, $levels || ''; + unless ( $class->log ) { - $levels ||= ''; - $levels =~ s/^\s+//; - $levels =~ s/\s+$//; - %levels = map { $_ => 1 } split /\s*,\s*/, $levels || ''; $class->log( Catalyst::Log->new(keys %levels) ); }