Bugzilla – Attachment 39893 Details for
Bug 14167
Add Koha::Logger based on Log4perl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14167: [QA Follow-up] Adjust category handling in Koha::Logger
Bug-14167-QA-Follow-up-Adjust-category-handling-in.patch (text/plain), 1.93 KB, created by
Marcel de Rooy
on 2015-06-05 08:56:35 UTC
(
hide
)
Description:
Bug 14167: [QA Follow-up] Adjust category handling in Koha::Logger
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-06-05 08:56:35 UTC
Size:
1.93 KB
patch
obsolete
>From 2659f6415a38405758c068b1f1f68ab6acf6e466 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 5 Jun 2015 10:08:22 +0200 >Subject: [PATCH] Bug 14167: [QA Follow-up] Adjust category handling in > Koha::Logger >Content-Type: text/plain; charset=utf-8 > >The first patch makes the category parameter mandatory. >This patch makes it optional, falling back to the current package. This is >the expected log4perl model. It would not be necessary to pass the class >name everywhere (check subclasses..) >It also adds a delimiter between the interface and the class name. > >This allows you to add config lines like: > >log4perl.logger.opac.C4.Auth = DEBUG, OPAC >log4perl.logger.intranet.C4.Circulation = TRACE, INTRANET > >The first line would make the logger more sensitive to C4::Auth log >messages while staying at the WARN level for other messages, etc. The >second line makes the trace visible from the renewal example. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Logger.pm | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > >diff --git a/Koha/Logger.pm b/Koha/Logger.pm >index 2fcbb6f..6ba0af8 100644 >--- a/Koha/Logger.pm >+++ b/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 >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14167
:
38953
|
38954
|
38980
|
38981
|
38993
|
39103
|
39180
|
39886
|
39887
|
39888
|
39889
|
39890
|
39891
|
39892
|
39893
|
39894
|
39895
|
40200
|
40652
|
40653
|
40657
|
40658
|
40659
|
40660
|
40661
|
40662
|
40663
|
40664
|
41109
|
41111
|
41145
|
41146