Eric Wilhelm > dotReader > dtRdr::Logger

Download:
dotReader-v0.11.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Source  

NAME ^

dtRdr::Logger - global logging

SYNOPSIS ^

  use dtRdr::Logger;
  L->debug($message, ...);
  L->info($message, ...);
  L->warn($message, ...);
  L->error($message, ...);
  L->fatal($message, ...);

For a stacktrace:

  sub bar {
    L()->logcluck("foo");
  }

See Log::Log4perl for more info.

ABOUT ^

This (currently) installs a $SIG{__WARN__}, though we'll probably try to move away from that.

import

  dtRdr::Logger->import(@args);

Get Logger ^

L

A shortcut to return a logger object FOR YOUR NAMESPACE with an optional list of subtags.

  L($subtag);

Example:

  package My::Package;
  my $logger = L;
  my $logger = L('#foo');

Now $logger will log into the class 'log4perl.logger.My.Package.#foo'.

$subtag MUST start with a #. If this is omitted, it will be changed.

RL

A shortcut to a root-level logger.

  RL($tag);

  my $logger = RL('#foo');

Now $logger which will log into the class 'log4perl.logger.#foo'.

$tag MUST start with a #. If this is omitted, it will be changed.

editor

Launches $ENV{THOUT_EDITOR} with a tempfile containing $string.

Just a handy way to get some debugging data into an editor.

  dtRdr::Logger->editor($string);

Or, to do lazy evaluation only when needed, pass a sub that returns a string.

  dtRdr::Logger->editor(sub {do_stuff_that_takes_time()});

DBG_DUMP

Similar to editor, but writes to a tempfile in "/tmp/$filename".

  DBG_DUMP($ENV_NAME, $filename, sub {$content});

Only acts if $ENV{"DBG_$ENV_NAME"} is set.

  DBG_FOO=1 ./Build test

...will cause this

  DBG_DUMP('foo', 'thisfile.txt', sub {$blah});

...to write the content of $blah to '/tmp/thisfile.txt'.

The sub {$thing} thing is a speed hack, but that variable is big enough to make you want to open it in an editor, so...

init

  dtRdr::Logger->init(filename => "foo");

AUTHOR ^

Eric Wilhelm <ewilhelm at cpan dot org>

http://scratchcomputing.com/

COPYRIGHT ^

Copyright (C) 2006 Eric L. Wilhelm and OSoft, All Rights Reserved.

NO WARRANTY ^

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

LICENSE ^

The dotReader(TM) is OSI Certified Open Source Software licensed under the GNU General Public License (GPL) Version 2, June 1991. Non-encrypted and encrypted packages are usable in connection with the dotReader(TM). The ability to create, edit, or otherwise modify content of such encrypted packages is self-contained within the packages, and NOT provided by the dotReader(TM), and is addressed in a separate commercial license.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

syntax highlighting: