2 |
## $Id$ |
## $Id$ |
3 |
## ------------------------------------------------------------------------ |
## ------------------------------------------------------------------------ |
4 |
## $Log$ |
## $Log$ |
5 |
## Revision 1.1 2003/12/16 19:22:26 ts-dev |
## Revision 1.3 2003/12/18 18:19:01 ts-dev |
6 |
|
## typo; create instance at startup |
7 |
|
## |
8 |
|
## Revision 1.2 2003/12/16 19:27:32 ts-dev |
9 |
## first check-in |
## first check-in |
10 |
## |
## |
11 |
## |
## |
41 |
$ENABLE_METHODS |
$ENABLE_METHODS |
42 |
$METHOD_LEVELS |
$METHOD_LEVELS |
43 |
$TRACE_STACK_LEVELS |
$TRACE_STACK_LEVELS |
44 |
$loggerai @EXPORT |
$logger @EXPORT |
45 |
); |
); |
|
@EXPORT = qw($logger); |
|
46 |
|
|
47 |
# default behaviour |
# default behaviour |
48 |
$LEVEL_DEFAULT = 'debug'; |
$LEVEL_DEFAULT = 'debug'; |
51 |
$ENABLE_METHODS = 0; |
$ENABLE_METHODS = 0; |
52 |
$METHOD_LEVELS = [3]; |
$METHOD_LEVELS = [3]; |
53 |
$TRACE_STACK_LEVELS = []; |
$TRACE_STACK_LEVELS = []; |
54 |
|
$logger = Class::Logger->new(); |
55 |
|
@EXPORT = qw($logger); |
56 |
|
|
57 |
|
|
58 |
# TODO: review, revise and rewire this! |
# TODO: review, revise and rewire this! |
236 |
|
|
237 |
$self->{__logger}->{level} ||= $LEVEL_DEFAULT; |
$self->{__logger}->{level} ||= $LEVEL_DEFAULT; |
238 |
$self->_configure_LogDispatch(); |
$self->_configure_LogDispatch(); |
239 |
local :Dispatch::Config::CallerDepth = 3; |
local ${Log::Dispatch::Config::CallerDepth} = 3; |
240 |
$self->{__logger}->{instance}->log( level => $self->{__logger}->{level}, message => $message ); |
$self->{__logger}->{instance}->log( level => $self->{__logger}->{level}, message => $message ); |
241 |
#$self->__init('log', $message); |
#$self->__init('log', $message); |
242 |
#$self->__out(); |
#$self->__out(); |
294 |
# $logger->info( __PACKAGE__ . "->trace: '$caller' (mixed into '$classname'): ($options->{tag}) $message."); |
# $logger->info( __PACKAGE__ . "->trace: '$caller' (mixed into '$classname'): ($options->{tag}) $message."); |
295 |
|
|
296 |
# V2: |
# V2: |
297 |
#local :Dispatch::Config::CallerDepth = 3; |
#local ${Log::Dispatch::Config::CallerDepth} = 3; |
298 |
#$self->{__logger}->{instance}->log( level => $self->{__logger}->{level}, message => $message ); |
#$self->{__logger}->{instance}->log( level => $self->{__logger}->{level}, message => $message ); |
299 |
$self->__init('trace', $message); |
$self->__init('trace', $message); |
300 |
$self->__out(); |
$self->__out(); |
389 |
crit critical alert emerg emergency) ) { |
crit critical alert emerg emergency) ) { |
390 |
*{$l} = sub { |
*{$l} = sub { |
391 |
my $self = shift; |
my $self = shift; |
392 |
local :Dispatch::Config::CallerDepth = |
local ${Log::Dispatch::Config::CallerDepth} = |
393 |
:Dispatch::Config::CallerDepth + 1; |
${Log::Dispatch::Config::CallerDepth} + 1; |
394 |
$self->log( "@_", $l ); |
$self->log( "@_", $l ); |
395 |
}; |
}; |
396 |
} |
} |
402 |
my ($message, $level) = @_; |
my ($message, $level) = @_; |
403 |
$level ||= 'debug'; |
$level ||= 'debug'; |
404 |
my $logger = $self->_get_instance(); |
my $logger = $self->_get_instance(); |
405 |
local $Log$ |
local ${Log::Dispatch::Config::CallerDepth} = ${Log::Dispatch::Config::CallerDepth} + 1; |
|
local Revision 1.1 2003/12/16 19:22:26 ts-dev |
|
|
local first check-in |
|
|
localLog::Dispatch::Config::CallerDepth + 1; |
|
406 |
$logger->log( level => $level, message => $message ); |
$logger->log( level => $level, message => $message ); |
407 |
} |
} |
408 |
|
|
412 |
local $Data::Dumper::Indent = 1; |
local $Data::Dumper::Indent = 1; |
413 |
local $Data::Dumper::Sortkeys = 1; |
local $Data::Dumper::Sortkeys = 1; |
414 |
my $dump = Dumper $data; |
my $dump = Dumper $data; |
415 |
local $Log$ |
local ${Log::Dispatch::Config::CallerDepth} = ${Log::Dispatch::Config::CallerDepth} + 1; |
|
local Revision 1.1 2003/12/16 19:22:26 ts-dev |
|
|
local first check-in |
|
|
localLog::Dispatch::Config::CallerDepth + 1; |
|
416 |
$self->log("DUMP: \n$dump", 'debug'); |
$self->log("DUMP: \n$dump", 'debug'); |
417 |
} |
} |
418 |
sub strace { |
sub strace { |
426 |
#$message .= qq# ${subroutine} ($filename line $line)\n#; |
#$message .= qq# ${subroutine} ($filename line $line)\n#; |
427 |
$message .= qq# ${subroutine} (line $line)\n#; |
$message .= qq# ${subroutine} (line $line)\n#; |
428 |
} |
} |
429 |
local $Log$ |
local ${Log::Dispatch::Config::CallerDepth} = ${Log::Dispatch::Config::CallerDepth} + 1; |
|
local Revision 1.1 2003/12/16 19:22:26 ts-dev |
|
|
local first check-in |
|
|
localLog::Dispatch::Config::CallerDepth + 1; |
|
430 |
$self->log($message, 'debug'); |
$self->log($message, 'debug'); |
431 |
} |
} |
432 |
|
|