[Catalyst] Problem with $c->log always on

Nate Wiger nwiger at scea.com
Tue Sep 12 20:24:33 CEST 2006


Matt S Trout wrote:
> Nate Wiger wrote:
>> It looks like $c->log is always on in a given Catalyst plugin. I have 
>> simple, standard code like this:
>>
>>     $c->log->debug("some message");
>>     $c->log->debug(Dumper(\%hash)) if $c->log->is_debug;
>>
>> When I dump out the $c->log->is*, all of them return true (actually, 
>> 1/4/16 depending on the level, I assume this is a bitmask byproduct).
>>
>> Any ideas? Anyone else seen this? I even double-checked my classes to 
>> make sure they aren't overriding it...
> 
> Log level config is separate from debug mode.
> 
> __PACKAGE__->log(Catalyst::Log->new(@levels));
> 
> or
> 
> $c->log->debug(...) if $c->debug; # this is what the Cat internals do

Ok, perhaps I'm a bit confused... reading the Catalyst::Log manpage, it 
seems I should just be able to write this:

    $c->log->whatever_level("message");

And it will/won't be shown depending on the runtime level config. Is 
that correct?

-Nate




More information about the Catalyst mailing list