NAME

DTA::TokWrap::Logger - DTA::Tokwrap logging facility using Log::Log4perl

SYNOPSIS

 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

DESCRIPTION

DTA::TokWrap::Logger provides an abstract base class for object-oriented access to the Log::Log4perl logging facility.

Functions: Initialization

logInit
 $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.

ensureLog
 PACKAGE->ensureLog()

Ensures that Log::Log4perl has been initialized.

logInitialized
 $bool = CLASS_OR_OBJECT->logInitialized();

Wrapper for Log::Log4perl->initialized().

Methods: get logger

logger
 $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

Methods: messages

trace
debug
info
warn
error
fatal
 $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().

llog
 $class_or_obj->llog($level, @msg);

Log message @msg at log-level $level, which should be a (numeric) constant exported by Log::Log4perl::Level.

vlog
 $class_or_obj->vlog($how, @msg);

Log message @msg at log-level $how, which may be one of the following:

Methods: carp, croak & friends

logwarn
logcarp
logcluck
 $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
logdie
logcroak
logconfess
 $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

SEE ALSO

DTA::TokWrap::Intro(3pm), dta-tokwrap.perl(1), ...

SEE ALSO

DTA::TokWrap::Intro(3pm), dta-tokwrap.perl(1), ...

AUTHOR

Bryan Jurish <jurish@bbaw.de>

COPYRIGHT AND LICENSE

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.