r19826 - in /branches/upstream/liblog-handler-perl/current: ./ lib/Log/ lib/Log/Handler/ lib/Log/Handler/Output/ lib/Log/Handler/Plugin/Config/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat May 10 19:19:45 UTC 2008


Author: gregoa
Date: Sat May 10 19:19:44 2008
New Revision: 19826

URL: http://svn.debian.org/wsvn/?sc=1&rev=19826
Log:
[svn-upgrade] Integrating new upstream version, liblog-handler-perl (0.41)

Modified:
    branches/upstream/liblog-handler-perl/current/ChangeLog
    branches/upstream/liblog-handler-perl/current/META.yml
    branches/upstream/liblog-handler-perl/current/README
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Config.pm
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Examples.pod
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Levels.pm
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Socket.pm
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Plugin/Config/Properties.pm

Modified: branches/upstream/liblog-handler-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/ChangeLog?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/ChangeLog (original)
+++ branches/upstream/liblog-handler-perl/current/ChangeLog Sat May 10 19:19:44 2008
@@ -1,3 +1,9 @@
+0.41    Released at 2008-05-09.
+        - Messages will be send to all outputs, even if a output is
+          not able to log a message. In version 0.40 the handler
+          stopped if a message couldn't be logged. That was bad.
+        - Did a lot code, POD and internal doc improvements.
+
 0.40    Released at 2008-05-04.
         - A full release - finally :-)
         - Kicked all <level>_and_trace and <level>_and_die methods.

Modified: branches/upstream/liblog-handler-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/META.yml?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/META.yml (original)
+++ branches/upstream/liblog-handler-perl/current/META.yml Sat May 10 19:19:44 2008
@@ -1,6 +1,6 @@
 ---
 name: Log-Handler
-version: 0.40
+version: 0.41
 author:
   - Jonny Schulz
 abstract: Log messages to one or more outputs.
@@ -29,13 +29,13 @@
 provides:
   Log::Handler:
     file: lib/Log/Handler.pm
-    version: 0.40
+    version: 0.41
   Log::Handler::Config:
     file: lib/Log/Handler/Config.pm
-    version: 0.01
+    version: 0.02
   Log::Handler::Levels:
     file: lib/Log/Handler/Levels.pm
-    version: 0.01
+    version: 0.02
   Log::Handler::Output:
     file: lib/Log/Handler/Output.pm
     version: 0.01
@@ -56,7 +56,7 @@
     version: 0.01
   Log::Handler::Output::Socket:
     file: lib/Log/Handler/Output/Socket.pm
-    version: 0.01
+    version: 0.02
   Log::Handler::Pattern:
     file: lib/Log/Handler/Pattern.pm
     version: 0.01
@@ -65,7 +65,7 @@
     version: 0.01
   Log::Handler::Plugin::Config::Properties:
     file: lib/Log/Handler/Plugin/Config/Properties.pm
-    version: 0.01
+    version: 0.02
   Log::Handler::Plugin::Config::YAML:
     file: lib/Log/Handler/Plugin/YAML.pm
     version: 0.01

Modified: branches/upstream/liblog-handler-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/README?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/README (original)
+++ branches/upstream/liblog-handler-perl/current/README Sat May 10 19:19:44 2008
@@ -78,10 +78,9 @@
         logging machine.
 
     timeformat
-        The option "timeformat" is used for the placeholder %T. You can set
-        "timeformat" with a date and time format that is converted with
-        "POSIX::strftime". The default format is "%b %d %H:%M:%S" and looks
-        like
+        The option "timeformat" is used to set the format for the
+        placeholder %T. The string is converted with "POSIX::strftime". The
+        default format is set to "%b %d %H:%M:%S" and looks like
 
             Feb 01 12:56:31
 
@@ -90,8 +89,9 @@
             2007/02/01 12:56:31
 
     dateformat
-        This options works like "timeformat". It's useful if you want to
-        split the date and time:
+        This options works like "timeformat". You can set a format that is
+        used for the placeholder %D. It's just useful if you want to split
+        the date and time:
 
             $log->add(file => {
                 filename       => 'file.log',
@@ -102,7 +102,7 @@
 
             $log->error("an error here");
 
-        Would log
+        This looks like
 
             2007-02-01 12:56:31 ERROR an error here
 
@@ -263,7 +263,7 @@
             # or $Log::Handler::ERRSTR
 
     filter
-        With this option it's possible to set a filter for the outputs. If
+        With this option it's possible to set a filter for the output. If
         the filter is set then only messages will be logged that match the
         filter. You can pass a regexp, a code reference or a simple string.
         Example:
@@ -332,7 +332,7 @@
 
             my $screen = $log->output('screen-out');
 
-            $screen->log('foo');
+            $screen->log(message => 'foo');
 
             # or in one step
 
@@ -340,9 +340,9 @@
 
     debug_trace
         You can activate a debugger that writes "caller()" informations for
-        each log level that would logged. The debugger is logging all
-        defined values except "hints" and "bitmask". Set "debug_trace" to 1
-        to activate the debugger. The debugger is set to 0 by default.
+        each active log level. The debugger is logging all defined values
+        except "hints" and "bitmask". Set "debug_trace" to 1 to activate the
+        debugger. The debugger is set to 0 by default.
 
     debug_mode
         There are two debug modes: line(1) and block(2) mode. The default
@@ -417,13 +417,6 @@
                  hasargs     1
                  wantarray   0
 
-        Another way to enable the debugger very shortly is ...
-
-            {
-                local $Log::Handler::TRACE = 1;
-                $log->info('backtrace');
-            }
-
     debug_skip
         This option let skip the "caller()" informations the count of
         "debug_skip".
@@ -440,10 +433,10 @@
     handler and the options for the output module you want to use. The
     output modules got it's own documentation for all options. As example if
     you want to add a file-output then take a look into the documentation of
-    Log::Handler::Output::File.
-
-    There are different ways to add a new output to the handler. The one way
-    is to create the output object yourself and pass it with the handler
+    Log::Handler::Output::File to see what options are available.
+
+    There are different ways to add a new output to the handler. One way is
+    to create the output object yourself and pass it with the handler
     options to "add()".
 
     Example:
@@ -517,7 +510,7 @@
             }
         );
 
-    The options will be splitted intern and you don't need to split it
+    The options will be splitted internal and you don't need to split it
     yourself, only if you want to do it yourself.
 
     Take a look to Log::Handler::Examples for more informations.
@@ -559,22 +552,8 @@
     current set of "minlevel" and "maxlevel" would log the message and FALSE
     if not.
 
-    The following example would dump the hash in any case and pass it to the
-    log handler:
-
-        $log->debug(Dumper(\%hash));
-
-    But that is not that what we really want! We want to dump the hash only
-    if the current log level would log it.
-
-        if ( $log->is_debug ) {
-            $log->debug(Dumper(\%hash));
-        }
-
-    The methods "is_err()", "is_crit()" and "is_emerg()" are just shortcuts.
-
   Other level methods
-    There exists a lot of other level methods.
+    There exists some other level methods.
 
     For a full list take a look into the documentation of
     Log::Handler::Levels.
@@ -617,7 +596,7 @@
     With this method it's possible to load your output configuration from a
     file.
 
-        $log->config(filename => 'file.conf');
+        $log->config(config => 'file.conf');
 
     Or
 

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm Sat May 10 19:19:44 2008
@@ -86,9 +86,9 @@
 
 =item B<timeformat>
 
-The option C<timeformat> is used for the placeholder C<%T>. You can set
-C<timeformat> with a date and time format that is converted with
-C<POSIX::strftime>. The default format is S<"%b %d %H:%M:%S"> and looks like
+The option C<timeformat> is used to set the format for the placeholder C<%T>.
+The string is converted with C<POSIX::strftime>. The default format is set to
+S<"%b %d %H:%M:%S"> and looks like
 
     Feb 01 12:56:31
 
@@ -98,8 +98,8 @@
 
 =item B<dateformat>
 
-This options works like C<timeformat>. It's useful if you want to split the
-date and time:
+This options works like C<timeformat>. You can set a format that is used for
+the placeholder C<%D>. It's just useful if you want to split the date and time:
 
     $log->add(file => {
         filename       => 'file.log',
@@ -110,7 +110,7 @@
 
     $log->error("an error here");
 
-Would log
+This looks like
 
     2007-02-01 12:56:31 ERROR an error here
 
@@ -273,7 +273,7 @@
 
 =item B<filter>
 
-With this option it's possible to set a filter for the outputs. If the filter
+With this option it's possible to set a filter for the output. If the filter
 is set then only messages will be logged that match the filter. You can pass a
 regexp, a code reference or a simple string. Example:
 
@@ -339,7 +339,7 @@
 
     my $screen = $log->output('screen-out');
 
-    $screen->log('foo');
+    $screen->log(message => 'foo');
 
     # or in one step
 
@@ -347,9 +347,9 @@
 
 =item B<debug_trace>
 
-You can activate a debugger that writes C<caller()> informations for each log
-level that would logged. The debugger is logging all defined values except
-C<hints> and C<bitmask>. Set C<debug_trace> to 1 to activate the debugger.
+You can activate a debugger that writes C<caller()> informations for each
+active log level. The debugger is logging all defined values except C<hints>
+and C<bitmask>. Set C<debug_trace> to 1 to activate the debugger.
 The debugger is set to 0 by default.
 
 =item B<debug_mode>
@@ -424,13 +424,6 @@
          hasargs     1
          wantarray   0
 
-Another way to enable the debugger very shortly is ...
-
-    {
-        local $Log::Handler::TRACE = 1;
-        $log->info('backtrace');
-    }
-
 =item B<debug_skip>
 
 This option let skip the C<caller()> informations the count of C<debug_skip>.
@@ -449,11 +442,11 @@
 The method C<add()> excepts 2 parts of options; the options for the handler and
 the options for the output module you want to use. The output modules got it's own
 documentation for all options. As example if you want to add a file-output then
-take a look into the documentation of L<Log::Handler::Output::File>.
-
-There are different ways to add a new output to the handler. The one way is
-to create the output object yourself and pass it with the handler options
-to C<add()>.
+take a look into the documentation of L<Log::Handler::Output::File> to see what
+options are available.
+
+There are different ways to add a new output to the handler. One way is to create
+the output object yourself and pass it with the handler options to C<add()>.
 
 Example:
 
@@ -525,7 +518,7 @@
         }
     );
 
-The options will be splitted intern and you don't need to split it yourself,
+The options will be splitted internal and you don't need to split it yourself,
 only if you want to do it yourself.
 
 Take a look to L<Log::Handler::Examples> for more informations.
@@ -590,23 +583,9 @@
 level would log the message. All methods returns TRUE if the current set
 of C<minlevel> and C<maxlevel> would log the message and FALSE if not.
 
-The following example would dump the hash in any case and pass it to the
-log handler:
-
-    $log->debug(Dumper(\%hash));
-
-But that is not that what we really want! We want to dump the hash only if
-the current log level would log it.
-
-    if ( $log->is_debug ) {
-        $log->debug(Dumper(\%hash));
-    }
-
-The methods C<is_err()>, C<is_crit()> and C<is_emerg()> are just shortcuts.
-
 =head2 Other level methods
 
-There exists a lot of other level methods.
+There exists some other level methods.
 
 For a full list take a look into the documentation of L<Log::Handler::Levels>.
 
@@ -650,7 +629,7 @@
 
 With this method it's possible to load your output configuration from a file.
 
-    $log->config(filename => 'file.conf');
+    $log->config(config => 'file.conf');
 
 Or
 
@@ -814,7 +793,7 @@
 use Log::Handler::Pattern;
 use base qw(Log::Handler::Levels);
 
-our $VERSION  = '0.40';
+our $VERSION  = '0.41';
 our $ERRSTR   = '';
 our $DEBUG    = 0;
 our $TRACE    = 0;
@@ -835,7 +814,7 @@
         fatal
 )\z/x;
 
-# to convert minlevel and maxlevel
+# to convert minlevel and maxlevel to a number
 our %LEVEL_BY_STRING = ( 
     DEBUG     =>  7,  
     INFO      =>  6,  
@@ -852,7 +831,8 @@
     FATAL     =>  0,
 );
 
-# to iterate from minlevel to maxlevel
+# to iterate from minlevel to maxlevel and
+# create an HoA with all active levels
 my @LEVEL_BY_NUM = qw(
     EMERGENCY
     ALERT
@@ -865,6 +845,7 @@
     NOTHING
 );
 
+# shortcuts for each output
 our %AVAILABLE_OUTPUTS = (
     file    => 'Log::Handler::Output::File',
     email   => 'Log::Handler::Output::Email',
@@ -908,7 +889,8 @@
     # hash-tree $self->{levels}->{INFO}. On this way it's possible
     # to check very fast if the level is active
     #
-    #   if (exists $self->{levels}->{INFO}) { ... }
+    #   my $levels = $self->{levels};
+    #   if (exists $levels->{INFO}) { ... }
     #
     # and loop over all output objects and pass the message to it.
 
@@ -946,6 +928,7 @@
 
     # Structure:
     #   $configs->{file} = [ output configs ];
+    #   $configs->{dbi}  = [ output configs ];
 
     while ( my ($type, $config) = each %$configs ) {
         for my $c (@$config) {
@@ -967,6 +950,10 @@
     if (ref($name) || !length($name)) {
         Carp::croak "invalid/missing name for pattern '$pattern'";
     }
+
+    # Structure:
+    #   $self->{pattern}->{'%X'}->{name} = 'name-of-x';
+    #   $self->{pattern}->{'%X'}->{code} = 'value-of-x';
 
     if (ref($proto) eq 'CODE') {
         $self->{pattern}->{$pattern}->{code} = $proto;
@@ -1157,16 +1144,20 @@
         $options{filter} = $self->_validate_filter($options{filter});
     }
 
+    # set a default priority if not set
     if (!defined $options{priority}) {
         $options{priority} = $self->{priority}++;
     }
 
+    # replace the level strings with numbers
     foreach my $opt (qw/minlevel maxlevel/) {
         next if $options{$opt} =~ /^\d\z/;
         my $level = uc($options{$opt});
         $options{$opt} = $LEVEL_BY_STRING{$level};
     }
 
+    # iterate from minlevel to maxlevel and create
+    # a hash tree with all active levels
     foreach my $level_num ($options{minlevel} .. $options{maxlevel}) {
         my $level = $LEVEL_BY_NUM[ $level_num ];
         $options{levels}{$level} = 1;
@@ -1184,6 +1175,15 @@
             }
             $wanted{$p} = undef;
         }
+
+        # If message_pattern is set to '%T %L %m' then the code
+        # should looks like:
+        #
+        #   sub {
+        #       my ($w, $m) = @_; # %wanted pattern, %message
+        #       $m->{$_} = $w->{$_} for qw/time level message/;
+        #   }
+
         my $func = 'sub { my ($w, $m) = @_; $m->{$_} = $w->{$_} for qw/';
         $func .= join(' ', map { $pattern->{$_}->{name} } keys %wanted);
         $func .= '/ }';
@@ -1197,9 +1197,16 @@
 
         # If the message layout is set to '%T [%L] %m' then the code
         # should looks like:
+        #
         #   sub {
-        #       my $m = shift;
-        #       $m->{time} . ' ]' . $m->{level} . '] ' . $m->{message}
+        #       my ($w, $m) = @_; # %wanted pattern, %message
+        #       $m->{message} = join('',
+        #           $w->{time},
+        #           ' [',
+        #           $w->{level},
+        #           '] ',
+        #           $w->{message}
+        #       );
         #   }
 
         foreach my $p ( split /(?:(%[a-zA-Z])|(%)%)/, $options{message_layout} ) {
@@ -1264,9 +1271,28 @@
         # Each matchN will be checked on the message and the BOOL results
         # will be stored to $filter->{result}->{matchN}. Then the results
         # will be passed to &code. &code returns 0 or 1.
-        #   $filter->{result}->{match1} = $message =~ $filter->{match1}
-        #   $filter->{result}->{match2} = $message =~ $filter->{match2}
-        #   $code = sub { my $m = shift; ($m->{match1} || $m->{match2}) }
+        #
+        # As example if the filter is set to
+        #
+        #   filter => {
+        #       match1    => qr/foo/,
+        #       match2    => qr/bar/,
+        #       condition => '(match1 && match2)',
+        #   }
+        #
+        # Then the bool results will be saved:
+        #
+        #   $filter->{result}->{match1} = $message =~ $filter->{match1};
+        #   $filter->{result}->{match2} = $message =~ $filter->{match2};
+        #
+        # The code for the filter should looks like:
+        #
+        #   $filter->{code} =
+        #       sub {
+        #           my $m = shift;
+        #           ($m->{match1} && $m->{match2})
+        #       }
+        #
         #   &$code($filter->{result});
 
         if (!defined $filter{condition} || $filter{condition} !~ /\w/) {
@@ -1304,8 +1330,7 @@
 }
 
 sub _raise_error {
-    my $self = shift;
-    $ERRSTR = shift;
+    $ERRSTR = $_[1];
     return undef;
 }
 

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Config.pm
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Config.pm?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Config.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Config.pm Sat May 10 19:19:44 2008
@@ -8,10 +8,24 @@
 
     my $log = Log::Handler->new();
 
-    $log->config(
-        config  => 'file.conf',
-        plugin  => 'YAML',
-        section => 'section-name',
+    # Config::General
+    $log->config(config => 'file.conf');
+
+    # Config::Properties
+    $log->config(config => 'file.props');
+
+    # YAML
+    $log->config(config => 'file.yaml');
+
+Or
+
+    use Log::Handler;
+
+    my $log = Log::Handler->new();
+
+    $log->config(
+        config => 'file.conf'
+        plugin => 'YAML',
     );
 
 Or
@@ -19,16 +33,16 @@
     use Log::Handler;
     use Log::Handler::Config;
 
-    my $conf = Log::Handler::Config->config(
-        config  => 'file.conf',
-        plugin  => 'YAML',
-        section => 'section-name',
+    my $config = Log::Handler::Config->config(
+        config  => 'file.conf'
     );
 
     my $log = Log::Handler->new();
 
-    while ( my ($type, $config) = each %$conf ) {
-        $log->add($type => $config);
+    while ( my ($output, $array) = each %$config ) {
+        foreach my $output_conf (@$array) {
+            $log->add($output => $output_conf);
+        }
     }
 
 =head1 DESCRIPTION
@@ -93,7 +107,7 @@
     <logger>
         <file>
             <mylog>
-                config = file.log
+                filename = file.log
                 minlevel = 0
                 maxlevel = 7
             </mylog>
@@ -142,7 +156,7 @@
 
 =head2 Config structure
 
-For each output object it must exist a own section. Here a example as hash:
+For each output it must exist an own section. Here a example as hash:
 
     my %config = (
 
@@ -150,12 +164,12 @@
 
         file => {
             foo => {
-                config => 'file1.log',
+                filename => 'file1.log',
                 maxlevel => 'info',
                 minlevel => 'warn',
             },
             bar => {
-                config => 'file2.log',
+                filename => 'file2.log',
                 maxlevel => 'error',
                 minlevel => 'emergency',
             }
@@ -181,8 +195,8 @@
 
 =head2 A default section
 
-If your configuration contains a C<default> section then this parameters are
-used for all other sections. Example:
+It's possible to define a section called C<default> for each output. This
+options are used as default if this options are not set. Example:
 
     my %config = (
         # the configuration for a file
@@ -191,17 +205,17 @@
                 mode     => 'append',
             },
             foo => {
-                config => 'file1.log',
+                filename => 'file1.log',
                 maxlevel => 'info',
                 minlevel => 'warn',
             },
             bar => {
-                config => 'file2.log',
+                filename => 'file2.log',
                 maxlevel => 'error',
                 minlevel => 'emergency',
             },
             baz => {
-                config => 'file3.log',
+                filename => 'file3.log',
                 maxlevel => 'debug',
                 minlevel => 'debug',
                 mode     => 'trunc',
@@ -209,7 +223,7 @@
         },
         # the configuration for dbi
         dbi => {
-            ...
+            default => { ... }
         }
     );
 
@@ -229,7 +243,7 @@
             mode = append
             timeformat = %b %d %H:%M:%S
             debug_mode = 2
-            config = example.log
+            filename = example.log
             minlevel = warn
             message_layout = '%T %H[%P] [%L] %S: %m'
             newline = 1
@@ -242,7 +256,7 @@
     file:
       mylog:
         debug_mode: 2
-        config: example.log
+        filename: example.log
         fileopen: 1
         maxlevel: info
         minlevel: warn
@@ -263,7 +277,7 @@
     file.mylog.timeformat = %b %d %H:%M:%S
     file.mylog.debug_mode = 2
     file.mylog.minlevel = warn
-    file.mylog.config = example.log
+    file.mylog.filename = example.log
     file.mylog.newline = 1
     file.mylog.message_layout = '%T %H[%P] [%L] %S: %m'
 
@@ -285,19 +299,19 @@
             </default>
 
             <common>
-                config = example.log
+                filename = example.log
                 maxlevel = info
                 minlevel = warn
             </common>
 
             <error>
-                config = example-error.log
+                filename = example-error.log
                 maxlevel = warn
                 minlevel = emergency
             </error>
 
             <debug>
-                config = example-debug.log
+                filename = example-debug.log
                 maxlevel = debug
                 minlevel = debug
             </debug>
@@ -328,19 +342,19 @@
         </default>
 
         <common>
-            config = example.log
+            filename = example.log
             maxlevel = info
             minlevel = warn
         </common>
 
         <error>
-            config = example-error.log
+            filename = example-error.log
             maxlevel = warn
             minlevel = emergency
         </error>
 
         <debug>
-            config = example-debug.log
+            filename = example-debug.log
             maxlevel = debug
             minlevel = debug
         </debug>
@@ -361,25 +375,25 @@
                     timeformat     => '%b %d %H:%M:%S',
                     fileopen       => 1,
                     reopen         => 1,
-                    mode           => 'append
+                    mode           => 'append',
                     message_layout => '%T %H[%P] [%L] %S: %m',
                     debug_mode     => 2,
                 },
                 common => {
-                    config => 'example.log',
+                    filename => 'example.log',
                     maxlevel => 'info',
                     minlevel => 'warn',
                 },
                 error => {
-                    config => 'example-error.log',
+                    filename => 'example-error.log',
                     maxlevel => 'warn',
                     minlevel => 'emergency',
                 },
                 debug => {
-                    config => 'example-debug.log',
+                    filename => 'example-debug.log',
                     maxlevel => 'debug',
                     minlevel => 'debug',
-                },
+                }
             }
         }
     );
@@ -400,13 +414,13 @@
             </default>
 
             <common>
-                config = example.log
+                filename = example.log
                 maxlevel = info
                 minlevel = warn
             </common>
 
             <error>
-                config = example-error.log
+                filename = example-error.log
                 maxlevel = warn
                 minlevel = emergency
             </error>
@@ -446,7 +460,7 @@
 
 use strict;
 use warnings;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use Carp;
 use File::Spec;
@@ -481,6 +495,10 @@
             $class->_is_hash('default', $type_config->{default});
             %default = (%{ $type_config->{default} });
         }
+
+        # Structure:
+        #   $all_configs{file} = [ \%a, \%b, \%c ]
+        #   $all_configs{dbi}  = [ \%a, \%b, \%c ]
 
         while ( my ($name, $log_config) = each %$type_config ) {
             $class->_is_hash($name, $log_config);

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Examples.pod
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Examples.pod?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Examples.pod (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Examples.pod Sat May 10 19:19:44 2008
@@ -29,7 +29,7 @@
         }
     );
 
-    $log->error("this error goes to the database");
+    $log->error('log an error');
 
 =head1 LOG VIA EMAIL
 
@@ -50,7 +50,7 @@
         }
     );
 
-    $log->emergency('this message will be send as email');
+    $log->emergency('log an emergency issue');
 
 =head1 LOG VIA FILE
 
@@ -68,7 +68,7 @@
         }
     );
 
-    $log->error("this is a error message");
+    $log->error('log an error');
 
 =head1 LOG VIA FORWARD
 
@@ -85,7 +85,7 @@
         }
     );
 
-    $log->info('Hello World!');
+    $log->info('log a information');
 
     sub my_func {
         my $params = shift;
@@ -108,7 +108,7 @@
         }
     );
 
-    $log->info('Hello World!');
+    $log->info('log to the screen');
 
 =head1 LOG VIA SOCKET
 
@@ -142,7 +142,7 @@
     my $sock = IO::Socket::INET->new(
         LocalAddr => '127.0.0.1',
         LocalPort => 44444,
-        Listen    => 1,
+        Listen    => 2,
     ) or die $!;
 
     my $file = Log::Handler::Output::File->new(
@@ -296,7 +296,7 @@
 
     my $log = Log::Handler->new();
 
-    $log->config(filename => 'file.conf');
+    $log->config(config => 'file.conf');
 
 =head1 CHECK FOR ACTIVE LEVELS
 
@@ -332,7 +332,7 @@
 
     # use Log::Handler alias => accessor;
     use Log::Handler myapp => 'LOG';
-    LOG->config(filename => 'myapp.conf');
+    LOG->config(config => 'myapp.conf');
 
 and then just inlucde C<Log::Handler> into all other modules of your project and
 use a global logger like:
@@ -352,7 +352,7 @@
     require Exporter;
     our @ISA = qw(Exporter);
     our @EXPORT = qw(LOG);
-    LOG->config(filename => 'myapp.conf');
+    LOG->config(config => 'myapp.conf');
     1;
 
 Now you can include C<MyAPP::Logger> into all the modules of your project and access

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Levels.pm
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Levels.pm?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Levels.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Levels.pm Sat May 10 19:19:44 2008
@@ -118,7 +118,7 @@
 
 =item B<warn()>
 
-This method logs the message with the level warning to the output and
+This method logs the message with the level C<warning> to the output and
 then calls C<Carp::carp()>.
 
     $log->warn('a warning here');
@@ -159,7 +159,7 @@
 use Carp;
 use Data::Dumper;
 
-our $VERSION  = '0.01';
+our $VERSION = '0.02';
 
 my %LEVELS_BY_ROUTINE = (
     debug     => 'DEBUG',
@@ -188,17 +188,23 @@
             use strict 'refs';
             my $self   = shift;
             my $levels = $self->{levels};
+            my $errors = ();
 
             if ( !$levels->{$level} ) {
                 return 1;
             }
 
             foreach my $output ( @{$levels->{$level}} ) {
-                $output->log($level, @_)
-                    or return $self->_raise_error($output->errstr);
+                if ( !$output->log($level, @_) ) {
+                    if ( defined $errors ) {
+                        $errors .= '; ' . $output->errstr;
+                    } else {
+                        $errors = $output->errstr;
+                    }
+                }
             }
 
-            return 1;
+            return defined $errors ? $self->_raise_error($errors) : 1;
         };
 
         # --------------------------------------------------------------

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Socket.pm
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Socket.pm?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Socket.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Socket.pm Sat May 10 19:19:44 2008
@@ -142,7 +142,7 @@
 use IO::Socket::INET;
 use Data::Dumper;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 our $ERRSTR  = '';
 
 sub new {
@@ -176,7 +176,7 @@
     $socket->send($message->{message}) or do {
         if ($self->{reconnect}) {
             $self->connect or return undef;
-            print $socket $message->{message}
+            $socket->send($message->{message})
                 or return $self->_raise_error("lost connection and reconnect fails: $!");
         } else {
             return $self->_raise_error("unable to send message: $!");

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Plugin/Config/Properties.pm
URL: http://svn.debian.org/wsvn/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Plugin/Config/Properties.pm?rev=19826&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Plugin/Config/Properties.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Plugin/Config/Properties.pm Sat May 10 19:19:44 2008
@@ -63,7 +63,8 @@
 use warnings;
 use Config::Properties;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
+our $SPLITTOTREE = qr/\./;
 
 sub get_config {
     my ($class, $config_file) = @_;
@@ -73,7 +74,7 @@
     $properties->load($fh);
     close $fh;
 
-    my $config = $properties->splitToTree(qr/\./);
+    my $config = $properties->splitToTree($SPLITTOTREE);
     return $config;
 }
 




More information about the Pkg-perl-cvs-commits mailing list