@@ -, +, @@ --- Koha/Logger.pm | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) --- a/Koha/Logger.pm +++ a/Koha/Logger.pm @@ -54,14 +54,20 @@ BEGIN { Log::Log4perl->init_once($conf); } -sub get { - my ( $class, $category, $interface ) = @_; +=head2 get - croak("No category passed in!") unless $category; + Returns a log4perl object. + Category and interface parameter are optional. + Normally, the category should follow the current package and the interface + should be set correctly via C4::Context. - $interface ||= C4::Context->interface(); +=cut - return Log::Log4perl->get_logger("$interface.$category"); +sub get { + my ( $class, $category, $interface ) = @_; + $interface ||= C4::Context->interface(); + $category = caller if !$category; + return Log::Log4perl->get_logger( $interface. '.'. $category ); } =head1 AUTHOR --