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
$logger->critical(...); my $long_message = Carp::longmess; foreach my $line ( $long_message =~ m/^.+$/msg ) { $logger->critical( $line ); } confess(...)
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
In reply to Log::Any with die and carp by learnedbyerror
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |