| 2 |
## $Id$ |
## $Id$ |
| 3 |
## ------------------------------------------------------------------------ |
## ------------------------------------------------------------------------ |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.3 2003/02/18 18:33:59 joko |
| 6 |
|
## + fix: just logs if possible |
| 7 |
|
## |
| 8 |
## Revision 1.2 2003/02/18 16:37:22 joko |
## Revision 1.2 2003/02/18 16:37:22 joko |
| 9 |
## + fix: ...::Hardwired is an optional module |
## + fix: ...::Hardwired is an optional module |
| 10 |
## |
## |
| 30 |
|
|
| 31 |
use Data::Dumper; |
use Data::Dumper; |
| 32 |
use Log::Dispatch; |
use Log::Dispatch; |
| 33 |
|
use Log::Dispatch::Screen; |
| 34 |
use Log::Dispatch::Config; |
use Log::Dispatch::Config; |
|
eval ("use Log::Dispatch::Configurator::Hardwired;"); |
|
| 35 |
use Cwd; |
use Cwd; |
| 36 |
|
use DesignPattern::Object; |
| 37 |
|
|
| 38 |
|
|
| 39 |
# TODO: review, revise and rewire this! |
# TODO: review, revise and rewire this! |
| 192 |
|
|
| 193 |
sub _configure_LogDispatch { |
sub _configure_LogDispatch { |
| 194 |
my $self = shift; |
my $self = shift; |
| 195 |
my $logHandlerMeta = Log::Dispatch::Configurator::Hardwired->new(); |
|
| 196 |
|
my $configurator = DesignPattern::Object->fromPackage('Log::Dispatch::Configurator::Hardwired'); |
| 197 |
|
|
| 198 |
|
# FIXME? |
| 199 |
my $basepath = cwd() . '/..'; |
my $basepath = cwd() . '/..'; |
|
#print "base: $basepath", "\n"; |
|
|
#exit; |
|
| 200 |
|
|
| 201 |
# configure custom logHandler |
# configure custom logHandler |
| 202 |
$logHandlerMeta->{file_filename} = "$basepath/var/log/logfile.txt"; |
|
| 203 |
$logHandlerMeta->{screen_min_level} = 'info'; |
if ($configurator) { |
| 204 |
|
|
| 205 |
if ($self->{quiet}) { |
$configurator->{file_filename} = "$basepath/var/log/logfile.txt"; |
| 206 |
$logHandlerMeta->{screen_min_level} = 8; |
$configurator->{screen_min_level} = 'info'; |
| 207 |
} |
|
| 208 |
|
if ($self->{quiet}) { |
| 209 |
|
$configurator->{screen_min_level} = 8; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
if ($self->{debug}) { |
| 213 |
|
$configurator->{screen_min_level} = 'debug'; |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
if ($self->{verbose}) { |
| 217 |
|
$configurator->{verbose} = 1; |
| 218 |
|
} |
| 219 |
|
|
| 220 |
if ($self->{debug}) { |
Log::Dispatch::Config->configure($configurator); |
| 221 |
$logHandlerMeta->{screen_min_level} = 'debug'; |
$self->{__logger}->{instance} = Log::Dispatch::Config->instance; |
| 222 |
} |
|
| 223 |
|
} else { |
| 224 |
|
|
| 225 |
|
#Log::Dispatch::Config->configure(); |
| 226 |
|
#Log::Dispatch->configure(); |
| 227 |
|
#$self->{__logger}->{instance} = Log::Dispatch->new; |
| 228 |
|
$self->{__logger}->{instance} = Log::Dispatch::Screen->new( name => 'screen', 'min_level' => 'debug', stderr => 1 ); |
| 229 |
|
|
|
if ($self->{verbose}) { |
|
|
$logHandlerMeta->{verbose} = 1; |
|
| 230 |
} |
} |
| 231 |
|
|
|
Log::Dispatch::Config->configure($logHandlerMeta); |
|
|
|
|
|
$self->{__logger}->{instance} = Log::Dispatch::Config->instance; |
|
| 232 |
|
|
| 233 |
} |
} |
| 234 |
|
|