Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Logging in Catalyst model

by falinf (Novice)
on Jul 13, 2011 at 18:32 UTC ( #914193=perlquestion: print w/ replies, xml ) Need Help??
falinf has asked for the wisdom of the Perl Monks concerning the following question:

greetings

I'm using catalyst and I have a custom model that gets data from a backend process. I of course want it to be able to log. Since I can't access

$c->log

should I just use

MyApp->log

for logging inside the model?

I want to do it in a correct way and keep all logging centralized. Also if I switch to another type of logging (ex via

$c->log( MyLogger->new );

) I don't want to have to configure that in more than one place.

thank you so muchs!

Comment on Logging in Catalyst model
Select or Download Code
Re: Logging in Catalyst model
by stonecolddevin (Vicar) on Jul 13, 2011 at 19:42 UTC

    There are various trains of thought on this, Bread::Board is an excellent option that will help you keep a lot of things like this in order and tidy. Otherwise, you have to pass a logging object to your model instantiation or the context object from Catalyst itself.

    Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

Re: Logging in Catalyst model
by Anonymous Monk on Nov 05, 2011 at 15:47 UTC
    Try Log::Any::Adapter::Catalyst

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://914193]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-10-26 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls