/[cvs]/nfo/perl/libs/Log/Dispatch/Config.pm
ViewVC logotype

Diff of /nfo/perl/libs/Log/Dispatch/Config.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Fri Dec 5 18:04:15 2003 UTC revision 1.3 by ts-dev, Wed Dec 10 17:29:40 2003 UTC
# Line 122  sub format_to_cb { Line 122  sub format_to_cb {
122      return undef unless defined $format;      return undef unless defined $format;
123    
124      # caller() called only when necessary      # caller() called only when necessary
125      my $needs_caller = $format =~ /%[FLP]/;      my $needs_caller = $format =~ /%[FLPS]/;
126      return sub {      return sub {
127          my %p = @_;          my %p = @_;
128          $p{p} = delete $p{level};          $p{p} = delete $p{level};
# Line 136  sub format_to_cb { Line 136  sub format_to_cb {
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)} = caller($depth);              @p{qw(P F L S)} = caller($depth);
140          }          }
141    
142          my $log = $format;          my $log = $format;
143          $log =~ s{          $log =~ s{
144              (%d(?:{(.*?)})?)|   # $1: datetime $2: datetime fmt              (%d(?:{(.*?)})?)|   # $1: datetime $2: datetime fmt
145              (?:%([%pmFLPni]))   # $3: others              (?:%([%pmFLPniS]))  # $3: others
146          }{          }{
147              if ($1 && $2) {              if ($1 && $2) {
148                  _strftime($2);                  _strftime($2);
# Line 264  C<format> defines log format. Possible c Line 264  C<format> defines log format. Possible c
264    %n    newline (\n)    %n    newline (\n)
265    %%    % itself    %%    % itself
266    %i    process-id, returns POSIX::getpid()    %i    process-id, returns POSIX::getpid()
267            %S  subroutine
268    
269  Note that datetime (%d) format is configurable by passing C<strftime>  Note that datetime (%d) format is configurable by passing C<strftime>
270  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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed