more useful options | |
PerlMonks |
Log::Any with die and carpby learnedbyerror (Monk) |
on Dec 16, 2018 at 18:43 UTC ( [id://1227324]=perlquestion: print w/replies, xml ) | Need Help?? |
learnedbyerror has asked for the wisdom of the Perl Monks concerning the following question: Hello Oh Wise Monks The village idiot returns with another request for your guidance. I have long been a devotee of the most excellent Log::Log4perl. However, I am currently working on a module that I think may benefit others and will place it on CPAN. As such, I plan to change the log producer to Log::Any. For most of my logging calls, this is a trivial change. There are several cases where the change is not so trivial. They are replacing $logger->logdie (which I shouldn't be using in a module anyway ) and more importantly the Log4perl levels that handle Carp: $logger->log(carp|cluck|croak|confess). My question is, "what are your recommended means of integrating Log::Any where die and Carp functionalities are needed?" Some of the options are not too disruptive, replace $logger->logdie(...)with $logger->logcritical(...) && die(...) Whereas cluck or confess would be something more like
NOTE: untested code example, intended for representative use only While functional, it seems inelegant to have to add these boilerplate lines or add a subroutine or class method to handle this. Are their more elegant ways of handling this need with Log::Any? Thanks in advance for your sage advice! lbe
Back to
Seekers of Perl Wisdom
|
|