Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I must confess that I lived a long time without logging and most modules on CPAN seem to implement no internal logging. I gave Log4Perl a try, but just could not get familiar with its complexity. The approach of lightweight modules like Log::Any and Log::Contextual that separate logger calling one one side, and logger configuration and actual logging on the other, looks more appealing. Log:Any seems to gain popularity, but also Log:Contextual (it's in Task::Kensho). I prefer the calling syntax of the second because the actual method is in a sub:
$log->trace('message pre-calculated'); # Log::Any log_trace {'message only if needed'}; # Log::Contextual
On the other hand Log::Any has almost the best way to include it in your module:
use Log::Any qw($log);
My ideal logger calling module should be included as
use Log::Module; # no more configuration!Do you know of any actual comparision of logging from Perl modules? Are there other pros and cons if you compare Log::Any and Log::Contextual or do you prefer a third module?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Methods for simple logging from modules
by Khen1950fx (Canon) on Jul 07, 2011 at 08:43 UTC | |
by voj (Acolyte) on Jul 07, 2011 at 13:59 UTC | |
|
Re: Methods for simple logging from modules
by pajout (Curate) on Jul 07, 2011 at 10:29 UTC |