Re: adding logging to Mason (need advice)
Dave Rolsky <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 19 Oct 2004, Jonathan Swartz wrote:
> >>Ok, I think I've come up with a good compromise that takes advantage of
> >>log4perl's features while allowing use of Log::Dispatch or other modules.
> >>
> >> http://www.masonhq.com/?LoggingAPIProposal
> >>
> >>Feedback please.
> >
> >
> > Looks good. I can add those methods to Log::Dispatch so we don't need to
> > provide a shim.
>
> Great! If you're pretty sure you can do that soon, I'll check in the
> docs to reflect it.
So I was tihnking about this, and now I'm not so sure it's such a great
idea.
I don't know that using this methods to avoid calling the actual log
methods will actually improve performance. With Log::Dispatch, calling
->would_log does about as much work as just calling ->log when no message
is sent. Calling both will only make things slower.
Looking at Log4Perl, I can see that it goes even further, and that if a
given log level isn't being logged to, then calls to log at that level end
up as noops.
So I think it'd be best if mason internally just did something like this:
$self->{logger}->error(...) if $self->{logger};
-dave
/*===========================
VegGuide.Org
Your guide to all that's veg.
===========================*/
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl