NAME

Thorium::Log - Logging support

VERSION

version 0.510

SYNOPSIS

use Thorium::Log;

my $log = Thorium::Log->new();

$log->warn('Some warning message');

DESCRIPTION

Thorium::Log is a high level wrapper class around Log::Log4perl's functionality. It exists to replace all prints and says. See Thorium::Roles::Logging for adding logging support via $self-log->...> to your object. You are encouraged to subclass and set prefix().

ATTRIBUTES

Optional Attributes

  • add_benchmarks (rw, Bool)

    Every time a log message is output ($log->$level($message)), additionally outputs a benchmark time line with the time elapsed since the last log message was output. Defaults to '0'.

  • caller_depth (rw, Int)

    Determines (additional) depth for caller inside Log4Perl. Defaults to '1'.

  • category (ro, Str)

    The category to use for Log::Log4Perl. This is used to set category specific log levels in the configuration. Default is the name of the package in which the Thorium::Log object was created.

  • config_file (rw, Str)

    The location of the configuration file to read. You may set the environment variable THORIUM_LOG_CONF_FILE otherwise /etc/thorium/log.conf will be used. An example is provided in this distribution under conf/log.conf. See Log::Log4Perl for details.

  • die_on_fatal (rw, Bool)

    Allows automatic die()ing for the fatal level. Defaults to '0'.

PUBLIC API METHODS

Levels

  • trace($str_or_ref, ...)

  • debug($str_or_ref, ...)

  • info($str_or_ref, ...)

  • warn($str_or_ref, ...)

  • error($str_or_ref, ...)

  • fatal($str_or_ref, ...)

Stack Traces

  • carp($str_or_ref, ...)

    Warn with one level of a stack trace.

  • cluck($str_or_ref, ...)

    Warn with full stack trace.

  • confress($str_or_ref, ...)

    Die with one level of a stack trace.

  • croak($str_or_ref, ...)

    Die with full stack trace.

AUTHOR

Adam Flott <adam@npjh.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Adam Flott <adam@npjh.com>, CIDC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.