--- nfo/perl/libs/Log/Dispatch/Config.pm 2003/12/05 18:04:15 1.2 +++ nfo/perl/libs/Log/Dispatch/Config.pm 2003/12/10 18:13:28 1.4 @@ -122,7 +122,7 @@ return undef unless defined $format; # caller() called only when necessary - my $needs_caller = $format =~ /%[FLP]/; + my $needs_caller = $format =~ /%[FLPS]/; return sub { my %p = @_; $p{p} = delete $p{level}; @@ -137,12 +137,16 @@ $depth++ while caller($depth) =~ /^Log::Dispatch/; $depth += :Dispatch::Config::CallerDepth; @p{qw(P F L)} = caller($depth); + my $subname = (caller($depth+1))[3]; + $p{S} = $subname; + $subname =~ s/^.*:://; + $p{s} = $subname; } my $log = $format; $log =~ s{ (%d(?:{(.*?)})?)| # $1: datetime $2: datetime fmt - (?:%([%pmFLPni])) # $3: others + (?:%([%pmFLPSnis])) # $3: others }{ if ($1 && $2) { _strftime($2); @@ -264,6 +268,8 @@ %n newline (\n) %% % itself %i process-id, returns POSIX::getpid() + %S subroutine with package name + %s subroutine without package name Note that datetime (%d) format is configurable by passing C fmt in braket after %d. (I know it looks quite messy, but its