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?
In reply to Methods for simple logging from modules by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |