[Catalyst] debug prints
Tomas Doran
bobtfish at bobtfish.net
Sun Mar 27 07:00:21 GMT 2011
On 5 Mar 2011, at 23:09, Nicholas Wehr wrote:
> use the log method of $c:
>
> $c->log->debug("my message");
>
> cheers,
> -nw
>
> On Sat, Mar 5, 2011 at 2:21 PM, John M. Dlugosz <wxju46gefd at snkmail.com
> > wrote:
> How do I send stuff to the console running the script/
> Appname_server.pl -d from a component method?
You'll need to capture $c (or better just $c->log?) in some way to do
this of course. It is provided at component setup time
(Catalyst::Role::ApplicationAttribute can be applied to automatically
capture it)..
Alternatively, you can just pick a log framework (e.g. log4perl), and
log into that (bypassing / reusing this logger for $c->log).
It's not entirely trivial as you quite possibly want an abstraction
layer there - e.g. if you're using a model outside Catalyst, then you
probably don't want to load Catalyst just for the logger :)
Cheers
t0m
More information about the Catalyst
mailing list