X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FLog%2FContextual.pm;h=b63a29de0afc09c4ca51ed33ac989b4f7c735b88;hb=30d7027abaddfbfc5df25e358e4d69a42cf2d316;hp=dcc623e58b95c194c787356c9eabfea31664a7e1;hpb=a6e29e27d45333c78c39b0efb767df162e8589de;p=p5sagit%2FLog-Contextual.git diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index dcc623e..b63a29d 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -186,7 +186,6 @@ Log::Contextual - Simple logging interface with a contextual log use Log::Log4perl ':easy'; Log::Log4perl->easy_init($DEBUG); - my $logger = Log::Log4perl->get_logger; set_logger $logger; @@ -226,14 +225,55 @@ with C: =head1 DESCRIPTION -This module is a simple interface to extensible logging. It is bundled with a -really basic logger, L, but in general you -should use a real logger instead of that. For something more serious but not -overly complicated, try L (see L for example.) +Major benefits: + +=over 2 + +=item * Efficient + +The logging functions take blocks, so if a log level is disabled, the +block will not run: + + # the following won't run if debug is off + log_debug { "the new count in the database is " . $rs->count }; + +Similarly, the C prefixed methods only C the input if the level is +enabled. + +=item * Handy + +The logging functions return their arguments, so you can stick them in +the middle of expressions: + + for (log_debug { "downloading:\n" . join qq(\n), @_ } @urls) { ... } + +=item * Generic + +C is an interface for all major loggers. If you log through +C you will be able to swap underlying loggers later. + +=item * Powerful + +C chooses which logger to use based on user defined Cs. +Normally you don't need to know this, but you can take advantage of it when you +need to later + +=item * Scalable + +If you just want to add logging to your extremely basic application, start with +L and then as your needs grow you can switch to +L or L or L or whatever else. + +=back + +This module is a simple interface to extensible logging. It exists to +abstract your logging interface so that logging is as painless as possible, +while still allowing you to switch from one logger to another. -The reason for this module is to abstract your logging interface so that -logging is as painless as possible, while still allowing you to switch from one -logger to another. +It is bundled with a really basic logger, L, +but in general you should use a real logger instead of that. For something +more serious but not overly complicated, try L (see +L for example.) =head1 A WORK IN PROGRESS