r70129 - in /branches/upstream/liblog-dispatchouli-perl/current: ./ lib/Log/ lib/Log/Dispatchouli/ t/ t/lib/ t/lib/DDR/ t/lib/SDR/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Mar 1 02:31:42 UTC 2011


Author: jawnsy-guest
Date: Tue Mar  1 02:31:29 2011
New Revision: 70129

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70129
Log:
[svn-upgrade] new version liblog-dispatchouli-perl (2.004)

Added:
    branches/upstream/liblog-dispatchouli-perl/current/t/env-value.t
    branches/upstream/liblog-dispatchouli-perl/current/t/global-subclass.t
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Child.pm
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Parent.pm
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Child.pm
    branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Parent.pm
Modified:
    branches/upstream/liblog-dispatchouli-perl/current/Changes
    branches/upstream/liblog-dispatchouli-perl/current/LICENSE
    branches/upstream/liblog-dispatchouli-perl/current/MANIFEST
    branches/upstream/liblog-dispatchouli-perl/current/META.json
    branches/upstream/liblog-dispatchouli-perl/current/META.yml
    branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL
    branches/upstream/liblog-dispatchouli-perl/current/README
    branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm
    branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm
    branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm
    branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t

Modified: branches/upstream/liblog-dispatchouli-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/Changes?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/Changes (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/Changes Tue Mar  1 02:31:29 2011
@@ -1,4 +1,18 @@
 Revision history for Log-Dispatchouli
+
+2.004     2011-01-21 15:52:41 America/New_York
+          BUG FIX:  it is okay to replace the default logger, always
+
+2.003     2011-01-21 13:14:43 America/New_York
+          add config_id to allow faking Global equality when testing
+
+2.002     2011-01-14 17:51:16 America/New_York
+          add env_value and env_prefix methods
+
+2.001     2011-01-13 12:45:05 America/New_York
+          greatly expanded tests and documentation for L::D::Global
+
+          L::D now has "string_flogger" method to provide an alternate flogger
 
 2.000     2010-11-23 18:48:53 America/New_York
 

Modified: branches/upstream/liblog-dispatchouli-perl/current/LICENSE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/LICENSE?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/LICENSE (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/LICENSE Tue Mar  1 02:31:29 2011
@@ -1,4 +1,4 @@
-This software is copyright (c) 2010 by Ricardo SIGNES.
+This software is copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2010 by Ricardo SIGNES.
+This software is Copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software, licensed under:
 
@@ -270,7 +270,7 @@
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2010 by Ricardo SIGNES.
+This software is Copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software, licensed under:
 

Modified: branches/upstream/liblog-dispatchouli-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/MANIFEST?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/MANIFEST (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/MANIFEST Tue Mar  1 02:31:29 2011
@@ -10,6 +10,12 @@
 lib/Log/Dispatchouli/Global.pm
 lib/Log/Dispatchouli/Proxy.pm
 t/basic.t
+t/env-value.t
+t/global-subclass.t
 t/global.t
+t/lib/DDR/Child.pm
+t/lib/DDR/Parent.pm
+t/lib/SDR/Child.pm
+t/lib/SDR/Parent.pm
 t/proxy.t
 t/release-pod-syntax.t

Modified: branches/upstream/liblog-dispatchouli-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/META.json?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/META.json (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/META.json Tue Mar  1 02:31:29 2011
@@ -4,7 +4,7 @@
       "Ricardo SIGNES <rjbs at cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400",
+   "generated_by" : "Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400",
    "license" : [
       "perl_5"
    ],
@@ -22,6 +22,7 @@
       "runtime" : {
          "requires" : {
             "Carp" : 0,
+            "File::Spec" : 0,
             "Log::Dispatch" : 0,
             "Log::Dispatch::Array" : 0,
             "Log::Dispatch::File" : 0,
@@ -52,118 +53,118 @@
          "url" : "git://git.codesimply.com/Log-Dispatchouli.git"
       }
    },
-   "version" : "2.000",
+   "version" : "2.004",
    "x_Dist_Zilla" : {
       "plugins" : [
          {
             "class" : "Dist::Zilla::Plugin::GatherDir",
             "name" : "@RJBS/@Basic/GatherDir",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PruneCruft",
             "name" : "@RJBS/@Basic/PruneCruft",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ManifestSkip",
             "name" : "@RJBS/@Basic/ManifestSkip",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "@RJBS/@Basic/MetaYAML",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "@RJBS/@Basic/License",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "@RJBS/@Basic/Readme",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExtraTests",
             "name" : "@RJBS/@Basic/ExtraTests",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "@RJBS/@Basic/ExecDir",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ShareDir",
             "name" : "@RJBS/@Basic/ShareDir",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MakeMaker",
             "name" : "@RJBS/@Basic/MakeMaker",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "@RJBS/@Basic/Manifest",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "@RJBS/@Basic/TestRelease",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "@RJBS/@Basic/ConfirmRelease",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "@RJBS/@Basic/UploadToCPAN",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::AutoPrereqs",
             "name" : "@RJBS/AutoPrereqs",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::NextVersion",
             "name" : "@RJBS/Git::NextVersion",
-            "version" : "1.102810"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::PkgVersion",
             "name" : "@RJBS/PkgVersion",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "@RJBS/MetaConfig",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "@RJBS/MetaJSON",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::NextRelease",
             "name" : "@RJBS/NextRelease",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "@RJBS/PodSyntaxTests",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Repository",
             "name" : "@RJBS/Repository",
-            "version" : "0.14"
+            "version" : "0.17"
          },
          {
             "class" : "Dist::Zilla::Plugin::Prereqs",
@@ -174,7 +175,7 @@
                }
             },
             "name" : "@RJBS/TestMoreWithSubtests",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodWeaver",
@@ -184,22 +185,22 @@
          {
             "class" : "Dist::Zilla::Plugin::Git::Check",
             "name" : "@RJBS/@Git/Check",
-            "version" : "1.102810"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Commit",
             "name" : "@RJBS/@Git/Commit",
-            "version" : "1.102810"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Tag",
             "name" : "@RJBS/@Git/Tag",
-            "version" : "1.102810"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Push",
             "name" : "@RJBS/@Git/Push",
-            "version" : "1.102810"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Prereqs",
@@ -210,27 +211,27 @@
                }
             },
             "name" : "Prereqs",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "4.102345"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "4.102345"
+            "version" : "4.200001"
          }
       ],
       "zilla" : {
@@ -238,7 +239,7 @@
          "config" : {
             "is_trial" : 0
          },
-         "version" : "4.102345"
+         "version" : "4.200001"
       }
    }
 }

Modified: branches/upstream/liblog-dispatchouli-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/META.yml?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/META.yml (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/META.yml Tue Mar  1 02:31:29 2011
@@ -9,7 +9,7 @@
 configure_requires:
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -17,6 +17,7 @@
 name: Log-Dispatchouli
 requires:
   Carp: 0
+  File::Spec: 0
   Log::Dispatch: 0
   Log::Dispatch::Array: 0
   Log::Dispatch::File: 0
@@ -32,97 +33,97 @@
   overload: 0
 resources:
   repository: git://git.codesimply.com/Log-Dispatchouli.git
-version: 2.000
+version: 2.004
 x_Dist_Zilla:
   plugins:
     -
       class: Dist::Zilla::Plugin::GatherDir
       name: '@RJBS/@Basic/GatherDir'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PruneCruft
       name: '@RJBS/@Basic/PruneCruft'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ManifestSkip
       name: '@RJBS/@Basic/ManifestSkip'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: '@RJBS/@Basic/MetaYAML'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::License
       name: '@RJBS/@Basic/License'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Readme
       name: '@RJBS/@Basic/Readme'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ExtraTests
       name: '@RJBS/@Basic/ExtraTests'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: '@RJBS/@Basic/ExecDir'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ShareDir
       name: '@RJBS/@Basic/ShareDir'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MakeMaker
       name: '@RJBS/@Basic/MakeMaker'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Manifest
       name: '@RJBS/@Basic/Manifest'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: '@RJBS/@Basic/TestRelease'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: '@RJBS/@Basic/ConfirmRelease'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: '@RJBS/@Basic/UploadToCPAN'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::AutoPrereqs
       name: '@RJBS/AutoPrereqs'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Git::NextVersion
       name: '@RJBS/Git::NextVersion'
-      version: 1.102810
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::PkgVersion
       name: '@RJBS/PkgVersion'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: '@RJBS/MetaConfig'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: '@RJBS/MetaJSON'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::NextRelease
       name: '@RJBS/NextRelease'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: '@RJBS/PodSyntaxTests'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Repository
       name: '@RJBS/Repository'
-      version: 0.14
+      version: 0.17
     -
       class: Dist::Zilla::Plugin::Prereqs
       config:
@@ -130,7 +131,7 @@
           phase: test
           type: requires
       name: '@RJBS/TestMoreWithSubtests'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PodWeaver
       name: '@RJBS/PodWeaver'
@@ -138,19 +139,19 @@
     -
       class: Dist::Zilla::Plugin::Git::Check
       name: '@RJBS/@Git/Check'
-      version: 1.102810
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Commit
       name: '@RJBS/@Git/Commit'
-      version: 1.102810
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Tag
       name: '@RJBS/@Git/Tag'
-      version: 1.102810
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Push
       name: '@RJBS/@Git/Push'
-      version: 1.102810
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Prereqs
       config:
@@ -158,25 +159,25 @@
           phase: runtime
           type: requires
       name: Prereqs
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: 4.102345
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: 4.102345
+      version: 4.200001
   zilla:
     class: Dist::Zilla::Dist::Builder
     config:
       is_trial: 0
-    version: 4.102345
+    version: 4.200001

Modified: branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL Tue Mar  1 02:31:29 2011
@@ -25,6 +25,7 @@
   'NAME' => 'Log::Dispatchouli',
   'PREREQ_PM' => {
     'Carp' => '0',
+    'File::Spec' => '0',
     'Log::Dispatch' => '0',
     'Log::Dispatch::Array' => '0',
     'Log::Dispatch::File' => '0',
@@ -39,7 +40,7 @@
     'Try::Tiny' => '0.04',
     'overload' => '0'
   },
-  'VERSION' => '2.000',
+  'VERSION' => '2.004',
   'test' => {
     'TESTS' => 't/*.t'
   }

Modified: branches/upstream/liblog-dispatchouli-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/README?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/README (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/README Tue Mar  1 02:31:29 2011
@@ -1,11 +1,11 @@
 
 
 This archive contains the distribution Log-Dispatchouli,
-version 2.000:
+version 2.004:
 
   a simple wrapper around Log::Dispatch
 
-This software is copyright (c) 2010 by Ricardo SIGNES.
+This software is copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

Modified: branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm Tue Mar  1 02:31:29 2011
@@ -2,11 +2,12 @@
 use warnings;
 package Log::Dispatchouli;
 BEGIN {
-  $Log::Dispatchouli::VERSION = '2.000';
+  $Log::Dispatchouli::VERSION = '2.004';
 }
 # ABSTRACT: a simple wrapper around Log::Dispatch
 
 use Carp ();
+use File::Spec ();
 use Log::Dispatch;
 use Params::Util qw(_ARRAY0 _HASH0 _CODELIKE);
 use Scalar::Util qw(blessed weaken);
@@ -21,6 +22,8 @@
 
   my $ident = $arg->{ident}
     or Carp::croak "no ident specified when using $class";
+
+  my $config_id = defined $arg->{config_id} ? $arg->{config_id} : $ident;
 
   my %quiet_fatal;
   for ('quiet_fatal') {
@@ -43,7 +46,7 @@
   if ($arg->{to_file}) {
     require Log::Dispatch::File;
     my $log_file = File::Spec->catfile(
-      ($ENV{DISPATCHOULI_PATH} || File::Spec->tmpdir),
+      ($self->env_value('PATH') || File::Spec->tmpdir),
       sprintf('%s.%04u%02u%02u',
         $ident,
         ((localtime)[5] + 1900),
@@ -67,7 +70,7 @@
     );
   }
 
-  if ($arg->{facility} and not $ENV{DISPATCHOULI_NOSYSLOG}) {
+  if ($arg->{facility} and not $self->env_value('NOSYSLOG')) {
     require Log::Dispatch::Syslog;
     $log->add(
       Log::Dispatch::Syslog->new(
@@ -114,12 +117,13 @@
   }
 
   $self->{dispatcher} = $log;
-  $self->{prefix} = $arg->{prefix};
-  $self->{ident}  = $ident;
+  $self->{prefix}     = $arg->{prefix};
+  $self->{ident}      = $ident;
+  $self->{config_id}  = $config_id;
 
   $self->{debug}  = exists $arg->{debug}
                   ? ($arg->{debug} ? 1 : 0)
-                  : ($ENV{DISPATCHOULI_DEBUG} ? 1 : 0);
+                  : ($self->env_value('DEBUG') ? 1 : 0);
 
   $self->{fail_fatal} = exists $arg->{fail_fatal} ? $arg->{fail_fatal} : 1;
 
@@ -137,7 +141,8 @@
 
   if ($arg->{fatal} or ! $self->get_muted) {
     try {
-      my @flogged = map {; String::Flogger->flog($_) } @rest;
+      my $flogger = $self->string_flogger;
+      my @flogged = map {; $flogger->flog($_) } @rest;
       $message    = @flogged > 1 ? $self->_join(\@flogged) : $flogged[0];
 
       my $prefix  = _ARRAY0($arg->{prefix})
@@ -225,6 +230,29 @@
 
 
 sub ident { $_[0]{ident} }
+
+
+sub config_id { $_[0]{config_id} }
+
+
+sub string_flogger { 'String::Flogger' }
+
+
+sub env_prefix { return; }
+
+
+sub env_value {
+  my ($self, $suffix) = @_;
+
+  my @path = grep { defined } ($self->env_prefix, 'DISPATCHOULI');
+
+  for my $prefix (@path) {
+    my $name = join q{_}, $prefix, $suffix;
+    return $ENV{ $name } if defined $ENV{ $name };
+  }
+
+  return;
+}
 
 
 sub new_tester {
@@ -307,7 +335,7 @@
 
 =head1 VERSION
 
-version 2.000
+version 2.004
 
 =head1 SYNOPSIS
 
@@ -367,6 +395,7 @@
   quiet_fatal - 'stderr' or 'stdout' or an arrayref of zero, one, or both
                 fatal log messages will not be logged to these
                 (default: stderr)
+  config_id   - a name for this logger's config; rarely needed!
 
 The log path is either F</tmp> or the value of the F<DISPATCHOULI_PATH> env var.
 
@@ -460,6 +489,13 @@
 
 This method returns the logger's ident.
 
+=head2 config_id
+
+This method returns the logger's configuration id, which defaults to its ident.
+This can be used to make two loggers equivalent in Log::Dispatchouli::Global so
+that trying to reinitialize with a new logger with the same C<config_id> as the
+current logger will not throw an exception, and will simply do no thing.
+
 =head2 dispatcher
 
 This returns the underlying Log::Dispatch object.  This is not the method
@@ -507,6 +543,32 @@
 ...will log...
 
   Batch 123: Subsystem 12: Page 9: Paragraph 6: Done.
+
+=head1 METHODS FOR SUBCLASSING
+
+=head2 string_flogger
+
+This method returns the thing on which F<flog> will be called to format log
+messages.  By default, it just returns C<String::Flogger>
+
+=head2 env_prefix
+
+This method should return a string used as a prefix to find environment
+variables that affect the logger's behavior.  For example, if this method
+returns C<XYZZY> then when checking the environment for a default value for the
+C<debug> parameter, Log::Dispatchouli will first check C<XYZZY_DEBUG>, then
+C<DISPATCHOULI_DEBUG>.
+
+By default, this method returns C<()>, which means no extra environment
+variable is checked.
+
+=head2 env_value
+
+  my $value = $logger->env_value('DEBUG');
+
+This method returns the value for the environment variable suffix given.  For
+example, the example given, calling with C<DEBUG> will check
+C<DISPATCHOULI_DEBUG>.
 
 =head1 METHODS FOR TESTING
 
@@ -613,7 +675,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Ricardo SIGNES.
+This software is copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

Modified: branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm Tue Mar  1 02:31:29 2011
@@ -2,7 +2,7 @@
 use warnings;
 package Log::Dispatchouli::Global;
 BEGIN {
-  $Log::Dispatchouli::Global::VERSION = '2.000';
+  $Log::Dispatchouli::Global::VERSION = '2.004';
 }
 # ABSTRACT: a system for sharing a global, dynamically-scoped logger
 
@@ -36,11 +36,12 @@
 }
 
 
-my $default_logger;
 sub default_logger {
   my ($self) = @_;
 
-  $default_logger ||= $self->default_logger_class->new(
+  my $ref = $self->default_logger_ref;
+
+  $$ref ||= $self->default_logger_class->new(
     $self->default_logger_args
   );
 }
@@ -56,6 +57,25 @@
   }
 }
 
+
+my %default_logger_for_glob;
+
+sub default_logger_ref {
+  my ($self) = @_;
+
+  my $glob = $self->logger_globref;
+  my $addr = Scalar::Util::refaddr($glob);
+  return \$default_logger_for_glob{ $addr };
+}
+
+sub _equiv {
+  my ($self, $x, $y) = @_;
+
+  return 1 if Scalar::Util::refaddr($x) == Scalar::Util::refaddr($y);
+  return 1 if $x->config_id eq $y->config_id;
+  return
+}
+
 sub _build_logger {
   my ($self, $arg) = @_;
 
@@ -65,15 +85,32 @@
   my $Logger  = $$$globref;
 
   if ($arg and $arg->{init}) {
-    if (
-      $Logger
-      and
-      Scalar::Util::refaddr($Logger) != Scalar::Util::refaddr($default)
+    my $new_logger = $self->default_logger_class->new($arg->{init});
+
+    if ($Logger
+      and not(
+        $self->_equiv($Logger, $new_logger)
+        or
+        $self->_equiv($Logger, $default)
+      )
     ) {
-      Carp::confess("attempted to initialize $self logger twice");
+      # We already set up a logger, so we'll check that our new one is
+      # equivalent to the old.  If so, we'll keep the old, since it's good
+      # enough.  If not, we'll raise an exception: you can't configure the
+      # logger twice, with different configurations, in one program!
+      # -- rjbs, 2011-01-21
+      my $old = $Logger->config_id;
+      my $new = $new_logger->config_id;
+
+      Carp::confess(sprintf(
+        "attempted to initialize %s logger twice; old config %s, new config %s",
+        $self,
+        $old,
+        $new,
+      ));
     }
 
-    $$$globref = $self->default_logger_class->new($arg->{init});
+    $$$globref = $new_logger;
   } else {
     $$$globref ||= $default;
   }
@@ -81,6 +118,7 @@
   return $globref;
 }
 
+
 1;
 
 __END__
@@ -92,7 +130,7 @@
 
 =head1 VERSION
 
-version 2.000
+version 2.004
 
 =head1 DESCRIPTION
 
@@ -195,13 +233,68 @@
 Its default return value creates a sink, so that anything logged without an
 initialized logger is lost.
 
+=head2 default_logger_ref
+
+This method returns a scalar reference in which the cached default value is
+stored for comparison.  This is used when someone tries to C<init> the global.
+When someone tries to initialize the global logger, and it's already set, then:
+
+=over 4
+
+=item *
+
+if the current value is the same as the default, the new value is set
+
+=item *
+
+if the current value is I<not> the same as the default, we die
+
+=back
+
+Since you want the default to be isolated to your application's logger, the
+default behavior is default loggers are associated with the glob reference to
+which the default might be assigned.  It is recommended that you replace this
+method to return a shared, private variable for your subclasses, by putting the
+following code in the base class for your Log::Dispatchouli::Global classes:
+
+  my $default_logger;
+  sub default_logger_ref { \$default_logger };
+
+=head1 COOKBOOK
+
+=head2 Common Logger Recipes
+
+Say you often use the same configuration for one kind of program, like
+automated tests.  You've already written your own subclass to get your own
+storage and defaults, maybe C<MyApp::Logger>.
+
+You can't just write a subclass with a different default, because if another
+class using the same global has set the global with I<its> default, yours won't
+be honored.  You don't just want this new value to be the default, you want it
+to be I<the> logger.  What you want to do in this case is to initialize your
+logger normally, then reexport it, like this:
+
+  package MyApp::Logger::Test;
+  use parent 'MyApp::Logger';
+
+  use MyApp::Logger '$Logger' => {
+    init => {
+      ident    => "Tester($0)",
+      to_self  => 1,
+      facility => undef,
+    },
+  };
+
+This will set up the logger and re-export it, and will properly die if anything
+else attempts to initialize the logger to something else.
+
 =head1 AUTHOR
 
 Ricardo SIGNES <rjbs at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Ricardo SIGNES.
+This software is copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

Modified: branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm Tue Mar  1 02:31:29 2011
@@ -2,7 +2,7 @@
 use warnings;
 package Log::Dispatchouli::Proxy;
 BEGIN {
-  $Log::Dispatchouli::Proxy::VERSION = '2.000';
+  $Log::Dispatchouli::Proxy::VERSION = '2.004';
 }
 # ABSTRACT: a simple wrapper around Log::Dispatch
 
@@ -38,7 +38,8 @@
 sub parent { $_[0]{parent} }
 sub logger { $_[0]{logger} }
 
-sub ident  { $_[0]{logger}->ident }
+sub ident     { $_[0]{logger}->ident }
+sub config_id { $_[0]{logger}->config_id }
 
 sub set_prefix   { $_[0]{prefix} = $_[1] }
 sub get_prefix   { $_[0]{prefix} }
@@ -119,7 +120,7 @@
 
 =head1 VERSION
 
-version 2.000
+version 2.004
 
 =head1 DESCRIPTION
 
@@ -152,7 +153,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Ricardo SIGNES.
+This software is copyright (c) 2011 by Ricardo SIGNES.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

Added: branches/upstream/liblog-dispatchouli-perl/current/t/env-value.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/env-value.t?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/env-value.t (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/env-value.t Tue Mar  1 02:31:29 2011
@@ -1,0 +1,44 @@
+#!perl
+use strict;
+use warnings;
+
+use Test::More;
+
+use Log::Dispatchouli;
+
+{
+  package Xyzzy::Logger;
+  use base 'Log::Dispatchouli';
+
+  sub env_prefix { 'XYZZY' }
+}
+
+{
+  local $ENV{DISPATCHOULI_DEBUG} = 1;
+  local $ENV{XYZZY_DEBUG} = 0;
+  my $d_logger = Log::Dispatchouli->new_tester;
+  my $x_logger = Xyzzy::Logger->new_tester;
+
+  ok(   $d_logger->is_debug, "DISPATCHOULI_ affects L::D logger");
+  ok( ! $x_logger->is_debug, "...but XYZZY_ overrides for X::L");
+}
+
+{
+  local $ENV{DISPATCHOULI_DEBUG} = 1;
+  my $d_logger = Log::Dispatchouli->new_tester;
+  my $x_logger = Xyzzy::Logger->new_tester;
+
+  ok(   $d_logger->is_debug, "DISPATCHOULI_ affects L::D logger");
+  ok(   $x_logger->is_debug, "...and X::L will use it with no XYZZY_");
+}
+
+{
+  local $ENV{XYZZY_DEBUG} = 1;
+  my $d_logger = Log::Dispatchouli->new_tester;
+  my $x_logger = Xyzzy::Logger->new_tester;
+
+  ok(   $x_logger->is_debug, "XYZZY_ affects X::L");
+  ok( ! $d_logger->is_debug, "...but not L::D");
+}
+
+done_testing;

Added: branches/upstream/liblog-dispatchouli-perl/current/t/global-subclass.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/global-subclass.t?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/global-subclass.t (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/global-subclass.t Tue Mar  1 02:31:29 2011
@@ -1,0 +1,40 @@
+use strict;
+use warnings;
+use Test::More;
+
+use Scalar::Util qw(refaddr);
+
+use lib 't/lib';
+
+# DDR - default default ref -- uses the default default_logger_ref
+{ package DDR_P; use DDR::Parent '$Logger'; }
+{ package DDR_C; use DDR::Child  '$Logger'; }
+
+# SDR - shared default ref -- uses a default_logger_ref shared between classes
+{ package SDR_P; use SDR::Parent '$Logger'; }
+{ package SDR_C; use SDR::Child  '$Logger'; }
+
+is(
+  refaddr( $DDR_P::Logger ),
+  refaddr( $DDR_C::Logger ),
+  "DDR parent and child share logger storage",
+);
+
+# DDR::Child can store its default in a different place, but
+# $DDR::Parent::Logger is already defined when we get here, so the logic is
+# "already defined and not equal to *my* default, so it is untouched."
+is($DDR_P::Logger->ident, 'DDR::Parent', "parent won the initialization race");
+
+is(
+  refaddr( $SDR_P::Logger ),
+  refaddr( $SDR_C::Logger ),
+  "SDR parent and child share logger storage",
+);
+
+is(
+  $SDR_P::Logger->ident,
+  'SDR::Parent',
+  "SDR::Parent is initialized first, so its default wins",
+);
+
+done_testing;

Added: branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Child.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Child.pm?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Child.pm (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Child.pm Tue Mar  1 02:31:29 2011
@@ -1,0 +1,11 @@
+use strict;
+package DDR::Child;
+use base 'DDR::Parent';
+sub default_logger_args {
+  return {
+    ident   => __PACKAGE__,
+    log_pid => 0,
+    to_self => 1,
+  }
+}
+1;

Added: branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Parent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Parent.pm?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Parent.pm (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/lib/DDR/Parent.pm Tue Mar  1 02:31:29 2011
@@ -1,0 +1,12 @@
+use strict;
+package DDR::Parent;
+use base 'Log::Dispatchouli::Global';
+sub logger_globref { no warnings 'once'; \*Logger }
+sub default_logger_args {
+  return {
+    ident   => __PACKAGE__,
+    log_pid => 0,
+    to_self => 1,
+  }
+}
+1;

Added: branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Child.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Child.pm?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Child.pm (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Child.pm Tue Mar  1 02:31:29 2011
@@ -1,0 +1,11 @@
+use strict;
+package SDR::Child;
+use base 'SDR::Parent';
+sub default_logger_args {
+  return {
+    ident   => __PACKAGE__,
+    log_pid => 0,
+    to_self => 1,
+  }
+}
+1;

Added: branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Parent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Parent.pm?rev=70129&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Parent.pm (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/lib/SDR/Parent.pm Tue Mar  1 02:31:29 2011
@@ -1,0 +1,15 @@
+use strict;
+package SDR::Parent;
+use base 'Log::Dispatchouli::Global';
+sub logger_globref { no warnings 'once'; \*Logger }
+
+my $default_logger;
+sub default_logger_ref { \$default_logger }
+sub default_logger_args {
+  return {
+    ident   => __PACKAGE__,
+    log_pid => 0,
+    to_self => 1,
+  }
+}
+1;

Modified: branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t?rev=70129&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t Tue Mar  1 02:31:29 2011
@@ -91,7 +91,7 @@
 $proxy->log_debug("proxy debug");
 $proxprox->log_debug("proxprox debug");
 
-are_events("debugging in middle tier", [
+are_events("debugging in middle tier (middle set_debug)", [
   'A: B: C: proxy debug',
   'A: B: C: E: F: proxprox debug',
 ]);




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