136 |
my $depth = 0; |
my $depth = 0; |
137 |
$depth++ while caller($depth) =~ /^Log::Dispatch/; |
$depth++ while caller($depth) =~ /^Log::Dispatch/; |
138 |
$depth += :Dispatch::Config::CallerDepth; |
$depth += :Dispatch::Config::CallerDepth; |
139 |
@p{qw(P F L S)} = caller($depth); |
@p{qw(P F L)} = caller($depth); |
140 |
|
my $subname = (caller($depth+1))[3]; |
141 |
|
$p{S} = $subname; |
142 |
|
$subname =~ s/^.*:://; |
143 |
|
$p{s} = $subname; |
144 |
} |
} |
145 |
|
|
146 |
my $log = $format; |
my $log = $format; |
147 |
$log =~ s{ |
$log =~ s{ |
148 |
(%d(?:{(.*?)})?)| # $1: datetime $2: datetime fmt |
(%d(?:{(.*?)})?)| # $1: datetime $2: datetime fmt |
149 |
(?:%([%pmFLPniS])) # $3: others |
(?:%([%pmFLPSnis])) # $3: others |
150 |
}{ |
}{ |
151 |
if ($1 && $2) { |
if ($1 && $2) { |
152 |
_strftime($2); |
_strftime($2); |
268 |
%n newline (\n) |
%n newline (\n) |
269 |
%% % itself |
%% % itself |
270 |
%i process-id, returns POSIX::getpid() |
%i process-id, returns POSIX::getpid() |
271 |
%S subroutine |
%S subroutine with package name |
272 |
|
%s subroutine without package name |
273 |
|
|
274 |
Note that datetime (%d) format is configurable by passing C<strftime> |
Note that datetime (%d) format is configurable by passing C<strftime> |
275 |
fmt in braket after %d. (I know it looks quite messy, but its |
fmt in braket after %d. (I know it looks quite messy, but its |