DTA::TokWrap::Logger - DTA::Tokwrap logging facility using Log::Log4perl
use DTA::TokWrap::Logger;
##========================================================================
## Functions: Initialization
PACKAGE->logInit();
PACKAGE->ensureLog();
$bool = CLASS_OR_OBJECT->logInitialized();
##========================================================================
## Methods: get logger
$logger = $class_or_obj->logger();
##========================================================================
## Methods: messages
$class_or_obj->trace (@msg); ##-- 'TRACE'-level message
$class_or_obj->debug (@msg); ##-- 'DEBUG'-level message
$class_or_obj->info (@msg); ##-- 'INFO'-level message
$class_or_obj->warn (@msg); ##-- 'WARN'-level message
$class_or_obj->error (@msg); ##-- 'ERROR'-level message
$class_or_obj->fatal (@msg); ##-- 'FATAL'-level message
$class_or_obj->llog($level, @msg); ##-- variable-level message (numeric)
$class_or_obj->vlog($how, @msg); ##-- variable-level message (symbolic)
##========================================================================
## Methods: carp, croak & friends
$class_or_obj->logwarn (@msg); ##-- warn w/o stack trace
$class_or_obj->logcarp (@msg); ##-- warn w/ 1-level stack trace
$class_or_obj->logcluck (@msg); ##-- warn w/ full stack trace
$class_or_obj->logdie (@msg); ##-- die w/o stack trace
$class_or_obj->logcroak (@msg); ##-- die w/ 1-level stack trace
$class_or_obj->logconfess(@msg); ##-- die w/ full stack trace
DTA::TokWrap::Logger provides an abstract base class for object-oriented access to the Log::Log4perl logging facility.
$PACKAGE->logInit() ##-- use default configuration
$PACKAGE->logInit($file) ##-- read configuration from a file
$PACKAGE->logInit(\$str) ##-- read configuration from a string
$PACKAGE->logInit($file,$watch) ##-- watch configuration file
Initialize the logging facility.
All log calls in the 'DTA::TokWrap' namespace should use a subcategory of 'DTA::TokWrap'. This function only needs to be called once; see Log::Log4perl->initialized() for details.
PACKAGE->ensureLog()
Ensures that Log::Log4perl has been initialized.
$bool = CLASS_OR_OBJECT->logInitialized();
Wrapper for Log::Log4perl->initialized().
$logger = $class_or_obj->logger();
$logger = $class_or_obj->logger($category)
Wrapper for Log::Log4perl::get_logger($category).
$category defaults to ref($class_or_obj)||$class_or_obj
$class_or_obj->trace (@msg); ##-- 'TRACE'-level message
$class_or_obj->debug (@msg); ##-- 'DEBUG'-level message
$class_or_obj->info (@msg); ##-- 'INFO'-level message
$class_or_obj->warn (@msg); ##-- 'WARN'-level message
$class_or_obj->error (@msg); ##-- 'ERROR'-level message
$class_or_obj->fatal (@msg); ##-- 'FATAL'-level message
Log messages at an explicit log-level.
Be sure you have called Log::Log4perl::init() or similar first, e.g. DTA::TokWrap::Logger::logInit().
$class_or_obj->llog($level, @msg);
Log message @msg at log-level $level, which should be a (numeric) constant exported by Log::Log4perl::Level.
$class_or_obj->vlog($how, @msg);
Log message @msg at log-level $how, which may be one of the following:
a CODE reference (e.g. $how=\&logsub) will cause $how->($class_or_obj,@msg) to be called.
a method name (e.g. $how='trace') will case calls $class_or_obj->${how}(@msg) to be called.
anything else (e.g. $how='none', $how=undef, ...) will be ignored.
$class_or_obj->logwarn (@msg); ##-- warn w/o stack trace
$class_or_obj->logcarp (@msg); ##-- warn w/ 1-level stack trace
$class_or_obj->logcluck (@msg); ##-- warn w/ full stack trace
$class_or_obj->logdie (@msg); ##-- die w/o stack trace
$class_or_obj->logcroak (@msg); ##-- die w/ 1-level stack trace
$class_or_obj->logconfess(@msg); ##-- die w/ full stack trace
DTA::TokWrap::Intro(3pm), dta-tokwrap.perl(1), ...
DTA::TokWrap::Intro(3pm), dta-tokwrap.perl(1), ...
Bryan Jurish <jurish@bbaw.de>
Copyright (C) 2009-2018 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.