http://www.perlmonks.org?node_id=936543

andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a Perl::Critic policy related to Log::Log4perl. The policy should require every logging statement to be surrounded by a conditional testing for the given log level, as shown here. Running Devel::NYTProf has shown that this code, as noted by the Log::Log4perl module's author, can have a significant negative impact on performance.
# Correct: if($logger->is_error()) { $logger->error("Erroneous array: @super_long_array"); } # Wrong - should emit a Perl::Critic warning $logger->error("Erroneous array: @super_long_array");
Does such a policy exist? If not, are there policies that are similar that I can base this new one on?

--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]