Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include logging in a Perl module?

Tags:

logging

perl

I'd like to include logging in a Perl module I am writing, but maintain portability so that applications that use it are not bound to a specific logging mechanism, such as Log::Log4Perl.

I've considered;

  1. Logging to STDERR and leaving it to the application to redirect these messages to it's own logging mechanism (as mentioned in the Log::Log4Perl FAQ).
  2. Including no logging in the module at all.

I suspect there is a better way.

like image 355
Hugh Avatar asked Oct 03 '11 14:10

Hugh


1 Answers

Log::Any

Log::Any allows CPAN modules to safely and efficiently log messages, while letting the application choose (or decline to choose) a logging mechanism such as Log::Dispatch or Log::Log4perl.

like image 136
daxim Avatar answered Sep 28 '22 05:09

daxim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!