2012/6/5 Dobrica Pavlinusic <dpavlin@rot13.org>
On Wed, Jun 06, 2012 at 02:22:20AM +1200, Chris Cormack wrote:
On 6 June 2012 02:17, Jared Camins-Esakov <jcamins@cpbibliography.com> wrote:
Jonathan,
I have developped a logging module (based on LogLite). I think it could be useful for Koha.
A new system preference controls the log level (eg. level warning for production and debug for development).
It can be used by a simple script or into Koha.
How it works: See Bug 8190 (http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8190)
Please have a look at that, and tell me what do you think about it. Technically, is it satisfying for you?
+1 from me for the idea. I didn't look at the code, but I love the idea.
What he said !
+1 from me.
Should we also wrap warn(s) to emit debug output like this?
$SIG{__WARN__} = sub { C4::Logger->new->debug( @_ ); }
Right now every warn in code makes patch fail QA (I know that first hand ;-) and it seems to me it's easier to just put warn instead of
C4::Logger->new->debug( "this used to be warn" );
The idea is to use the global variable $log, instead of call each times C4::Logger->new Your ligne become: $log->debug("my debug message"); Yes it's a little bit longer. But if you have a structure, you can call debug with a flag in 2nd param like this: $hash; $log->debug($hash, 1); instead of warn Data::Dumper::Dumper $hash; it's shorter ;-)