]> git.evergreen-ils.org Git - OpenSRF.git/commit
LP#1824181: Allow 1st arg to logger to be string or subroutine
authorJohn Merriam <jmerriam@biblio.org>
Wed, 10 Apr 2019 13:51:54 +0000 (09:51 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 7 Jun 2019 15:34:04 +0000 (11:34 -0400)
commit37dcdcab5a97e06259a859a1721f243978f35a66
tree29b8d1b19c22e7cfde5f0246bef813a3d623929e
parent1eff7ee443beda4037a3edb8e2cd6caa37ee6d85
LP#1824181: Allow 1st arg to logger to be string or subroutine

This simple change allows the $msg passed to _log_message in Logger.pm
to be either a regular string or a delayed exec subroutine. This is in
reaction to LP1823338 where a slow debug logging statement was slowing
down SIP checkins even though debug logging was not turned on.

With this change you can take this:

$log->debug("Available methods\n\t".join("\n\t", keys %{ $_METHODS[$proto] }), INTERNAL);

and change it to this:

$log->debug(sub{return "Available methods\n\t".join("\n\t", keys %{ $_METHODS[$proto] }) }, INTERNAL);

and then that slow debug logging line will not be executed unless
debug logging is turned on.

Signed-off-by: John Merriam <jmerriam@biblio.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
src/perl/lib/OpenSRF/Utils/Logger.pm