--- nfo/perl/libs/DesignPattern/Logger.pm 2003/02/20 21:06:27 1.2 +++ nfo/perl/libs/DesignPattern/Logger.pm 2003/06/06 03:19:09 1.6 @@ -1,7 +1,19 @@ ## ------------------------------------------------------------------------ -## $Id: Logger.pm,v 1.2 2003/02/20 21:06:27 joko Exp $ +## $Id: Logger.pm,v 1.6 2003/06/06 03:19:09 joko Exp $ ## ------------------------------------------------------------------------ ## $Log: Logger.pm,v $ +## Revision 1.6 2003/06/06 03:19:09 joko +## minor fixes +## +## Revision 1.5 2003/05/13 08:40:15 joko +## minor update: renamed attribute +## +## Revision 1.4 2003/03/29 07:16:00 joko +## minor update: changed default log-file-name to 'perl_app.log' +## +## Revision 1.3 2003/03/28 07:23:25 joko +## fix to basepath calculation +## ## Revision 1.2 2003/02/20 21:06:27 joko ## + configurable by package globals ## + standalone mode (object creation via 'new') @@ -34,6 +46,16 @@ ## ------------------------------------------------------------------------ +=pod + + This is weird! Forget it. + But we depend on it! + Hmmm.... + + +=cut + + package DesignPattern::Logger; use strict; @@ -125,10 +147,11 @@ foreach (@{$METHOD_LEVELS}) { (my $c_package, my $c_filename, my $c_line, my $c_subroutine, my $c_hasargs, my $c_wantarray, my $c_evaltext, my $c_is_require, my $c_hints, my $c_bitmask) = caller($_); + $c_subroutine ||= ''; $c_subroutine =~ s/.*:://; push @methods, $c_subroutine; } - $calling_sub = join(': ', @methods); + $calling_sub = join(': ', @methods) if @methods; } @@ -321,14 +344,19 @@ my $configurator = DesignPattern::Object->fromPackage('Log::Dispatch::Configurator::Hardwired'); - # FIXME? - my $basepath = cwd() . '/..'; + # check if running inside a 'PROJECT' space + my $basepath = cwd(); + my $postpone = '/..'; + if (-d $basepath . $postpone . '/PROJECT') { + $basepath .= $postpone; + $basepath .= "/var/log"; + } # configure custom logHandler if ($configurator) { - $configurator->{file_filename} = "$basepath/var/log/logfile.txt"; + $configurator->{file_filename} = "$basepath/perl_app.log"; $configurator->{screen_min_level} = 'info'; if ($self->{quiet}) { @@ -339,7 +367,7 @@ $configurator->{screen_min_level} = 'debug'; } - if ($self->{verbose}) { + if ($self->{LOG_VERBOSE}) { $configurator->{verbose} = 1; }