| 2 |
## $Id$ |
## $Id$ |
| 3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.8 2003/02/19 00:36:59 joko |
| 6 |
|
## + bugfix: this {logger} is the instance itself, so has to be fed with ( level => xyz and namespace => xyz ) |
| 7 |
|
## + minor modifications in behaviour |
| 8 |
|
## |
| 9 |
## Revision 1.7 2003/02/18 18:34:35 joko |
## Revision 1.7 2003/02/18 18:34:35 joko |
| 10 |
## + fix: just logs if possible (sub log_basic) |
## + fix: just logs if possible (sub log_basic) |
| 11 |
## |
## |
| 167 |
# report errors |
# report errors |
| 168 |
if ($@) { |
if ($@) { |
| 169 |
# build error-messages |
# build error-messages |
| 170 |
my $errmsg_native = __PACKAGE__ . ':' . __LINE__ . " Error in eval \"$evstring\": " . $@; |
my $issuer = __PACKAGE__ . ':' . __LINE__; |
| 171 |
|
my $errmsg_native = "Error in eval: " . $@; |
| 172 |
#my $classname = $self->{__classname}; |
#my $classname = $self->{__classname}; |
| 173 |
my $errmsg_critical = ''; |
my $errmsg_critical = ''; |
| 174 |
if ($errmsg_native =~ m/Can't locate (.+?) in \@INC/) { |
if ($errmsg_native =~ m/Can't locate (.+?) in \@INC/) { |
| 177 |
$errmsg_critical = $errmsg_native; |
$errmsg_critical = $errmsg_native; |
| 178 |
} |
} |
| 179 |
# write error to logging-output (console|file|database) |
# write error to logging-output (console|file|database) |
| 180 |
$self->log_basic( $errmsg_native, 'debug' ); |
$self->log_basic( $errmsg_native . " (issuer='$issuer', code='$evstring')", 'debug' ); |
| 181 |
$self->log_basic( $errmsg_critical, 'warning' ); |
$self->log_basic( $errmsg_critical, 'warning' ); |
| 182 |
return; |
return; |
| 183 |
} |
} |
| 196 |
my $self = shift; |
my $self = shift; |
| 197 |
my $message = shift; |
my $message = shift; |
| 198 |
my $level = shift; |
my $level = shift; |
| 199 |
|
|
| 200 |
|
#return; |
| 201 |
|
$level ||= 'info'; |
| 202 |
|
|
| 203 |
if ($_dp_globals->{TRACE} || ($level && $level =~ /warning|error|critical/)) { |
if ($_dp_globals->{TRACE} || ($level && $level =~ /warning|error|critical/)) { |
| 204 |
print $level, ": ", $message, "\n"; |
print $level, ": ", $message, "\n"; |
| 210 |
} |
} |
| 211 |
|
|
| 212 |
if ($_dp_globals->{logger}) { |
if ($_dp_globals->{logger}) { |
| 213 |
$_dp_globals->{logger}->log($level, $message); |
$_dp_globals->{logger}->log( level => $level, message => $message); |
| 214 |
#} else { |
#} else { |
| 215 |
#print $level, ": ", $message, "\n"; |
#print $level, ": ", $message, "\n"; |
| 216 |
} |
} |