r66417 - in /branches/upstream/liblog-dispatchouli-perl/current: Changes MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Log/Dispatchouli.pm lib/Log/Dispatchouli/Global.pm lib/Log/Dispatchouli/Proxy.pm t/basic.t t/global.t t/proxy.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Dec 26 00:55:32 UTC 2010
Author: jawnsy-guest
Date: Sun Dec 26 00:55:20 2010
New Revision: 66417
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66417
Log:
[svn-upgrade] new version liblog-dispatchouli-perl (2.000)
Added:
branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm
branches/upstream/liblog-dispatchouli-perl/current/t/global.t
Modified:
branches/upstream/liblog-dispatchouli-perl/current/Changes
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/dist.ini
branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm
branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Proxy.pm
branches/upstream/liblog-dispatchouli-perl/current/t/basic.t
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/Changes (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/Changes Sun Dec 26 00:55:20 2010
@@ -1,4 +1,6 @@
Revision history for Log-Dispatchouli
+
+2.000 2010-11-23 18:48:53 America/New_York
1.102350 2010-08-23 08:55:17 America/New_York
fix a bug in generating tempdirs for file logging (thanks, Sawyer X)
Modified: branches/upstream/liblog-dispatchouli-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/MANIFEST?rev=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/MANIFEST (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/MANIFEST Sun Dec 26 00:55:20 2010
@@ -7,7 +7,9 @@
README
dist.ini
lib/Log/Dispatchouli.pm
+lib/Log/Dispatchouli/Global.pm
lib/Log/Dispatchouli/Proxy.pm
t/basic.t
+t/global.t
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/META.json (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/META.json Sun Dec 26 00:55:20 2010
@@ -4,7 +4,7 @@
"Ricardo SIGNES <rjbs at cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.102220, CPAN::Meta::Converter version 2.102160",
+ "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400",
"license" : [
"perl_5"
],
@@ -30,6 +30,8 @@
"Params::Util" : 0,
"Scalar::Util" : 0,
"String::Flogger" : 0,
+ "Sub::Exporter" : 0,
+ "Sub::Exporter::GlobExporter" : "0.002",
"Sys::Syslog" : "0.16",
"Try::Tiny" : "0.04",
"overload" : 0
@@ -38,7 +40,8 @@
"test" : {
"requires" : {
"Test::Deep" : 0,
- "Test::More" : "0.88"
+ "Test::Fatal" : 0,
+ "Test::More" : "0.96"
}
}
},
@@ -49,174 +52,185 @@
"url" : "git://git.codesimply.com/Log-Dispatchouli.git"
}
},
- "version" : "1.102350",
+ "version" : "2.000",
"x_Dist_Zilla" : {
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"name" : "@RJBS/@Basic/GatherDir",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@RJBS/@Basic/PruneCruft",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@RJBS/@Basic/ManifestSkip",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@RJBS/@Basic/MetaYAML",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@RJBS/@Basic/License",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@RJBS/@Basic/Readme",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@RJBS/@Basic/ExtraTests",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@RJBS/@Basic/ExecDir",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@RJBS/@Basic/ShareDir",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"name" : "@RJBS/@Basic/MakeMaker",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@RJBS/@Basic/Manifest",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@RJBS/@Basic/TestRelease",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@RJBS/@Basic/ConfirmRelease",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@RJBS/@Basic/UploadToCPAN",
- "version" : "4.102220"
- },
- {
- "class" : "Dist::Zilla::Plugin::AutoPrereq",
- "name" : "@RJBS/AutoPrereq",
- "version" : "4.102220"
- },
- {
- "class" : "Dist::Zilla::Plugin::AutoVersion",
- "name" : "@RJBS/AutoVersion",
- "version" : "4.102220"
+ "version" : "4.102345"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+ "name" : "@RJBS/AutoPrereqs",
+ "version" : "4.102345"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::NextVersion",
+ "name" : "@RJBS/Git::NextVersion",
+ "version" : "1.102810"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "@RJBS/PkgVersion",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@RJBS/MetaConfig",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@RJBS/MetaJSON",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::NextRelease",
"name" : "@RJBS/NextRelease",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@RJBS/PodSyntaxTests",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::Repository",
"name" : "@RJBS/Repository",
- "version" : "0.13"
+ "version" : "0.14"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "test",
+ "type" : "requires"
+ }
+ },
+ "name" : "@RJBS/TestMoreWithSubtests",
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"name" : "@RJBS/PodWeaver",
- "version" : "3.101640"
+ "version" : "3.101641"
},
{
"class" : "Dist::Zilla::Plugin::Git::Check",
"name" : "@RJBS/@Git/Check",
- "version" : "1.102090"
+ "version" : "1.102810"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"name" : "@RJBS/@Git/Commit",
- "version" : "1.102090"
+ "version" : "1.102810"
},
{
"class" : "Dist::Zilla::Plugin::Git::Tag",
"name" : "@RJBS/@Git/Tag",
- "version" : "1.102090"
+ "version" : "1.102810"
},
{
"class" : "Dist::Zilla::Plugin::Git::Push",
"name" : "@RJBS/@Git/Push",
- "version" : "1.102090"
- },
- {
- "class" : "Dist::Zilla::Plugin::Prereq",
+ "version" : "1.102810"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "runtime",
"type" : "requires"
}
},
- "name" : "Prereq",
- "version" : "4.102220"
+ "name" : "Prereqs",
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
- "version" : "4.102220"
+ "version" : "4.102345"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
- "version" : "4.102220"
+ "version" : "4.102345"
}
],
"zilla" : {
@@ -224,7 +238,7 @@
"config" : {
"is_trial" : 0
},
- "version" : "4.102220"
+ "version" : "4.102345"
}
}
}
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/META.yml (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/META.yml Sun Dec 26 00:55:20 2010
@@ -4,11 +4,12 @@
- 'Ricardo SIGNES <rjbs at cpan.org>'
build_requires:
Test::Deep: 0
- Test::More: 0.88
+ Test::Fatal: 0
+ Test::More: 0.96
configure_requires:
ExtUtils::MakeMaker: 6.31
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.102220, CPAN::Meta::Converter version 2.102160'
+generated_by: 'Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.102400'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,148 +25,158 @@
Params::Util: 0
Scalar::Util: 0
String::Flogger: 0
+ Sub::Exporter: 0
+ Sub::Exporter::GlobExporter: 0.002
Sys::Syslog: 0.16
Try::Tiny: 0.04
overload: 0
resources:
repository: git://git.codesimply.com/Log-Dispatchouli.git
-version: 1.102350
+version: 2.000
x_Dist_Zilla:
plugins:
-
class: Dist::Zilla::Plugin::GatherDir
name: '@RJBS/@Basic/GatherDir'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@RJBS/@Basic/PruneCruft'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@RJBS/@Basic/ManifestSkip'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@RJBS/@Basic/MetaYAML'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::License
name: '@RJBS/@Basic/License'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::Readme
name: '@RJBS/@Basic/Readme'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@RJBS/@Basic/ExtraTests'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::ExecDir
name: '@RJBS/@Basic/ExecDir'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::ShareDir
name: '@RJBS/@Basic/ShareDir'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::MakeMaker
name: '@RJBS/@Basic/MakeMaker'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::Manifest
name: '@RJBS/@Basic/Manifest'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::TestRelease
name: '@RJBS/@Basic/TestRelease'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@RJBS/@Basic/ConfirmRelease'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@RJBS/@Basic/UploadToCPAN'
- version: 4.102220
+ version: 4.102345
-
- class: Dist::Zilla::Plugin::AutoPrereq
- name: '@RJBS/AutoPrereq'
- version: 4.102220
+ class: Dist::Zilla::Plugin::AutoPrereqs
+ name: '@RJBS/AutoPrereqs'
+ version: 4.102345
-
- class: Dist::Zilla::Plugin::AutoVersion
- name: '@RJBS/AutoVersion'
- version: 4.102220
+ class: Dist::Zilla::Plugin::Git::NextVersion
+ name: '@RJBS/Git::NextVersion'
+ version: 1.102810
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@RJBS/PkgVersion'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@RJBS/MetaConfig'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@RJBS/MetaJSON'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::NextRelease
name: '@RJBS/NextRelease'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@RJBS/PodSyntaxTests'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::Repository
name: '@RJBS/Repository'
- version: 0.13
+ version: 0.14
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: test
+ type: requires
+ name: '@RJBS/TestMoreWithSubtests'
+ version: 4.102345
-
class: Dist::Zilla::Plugin::PodWeaver
name: '@RJBS/PodWeaver'
- version: 3.101640
+ version: 3.101641
-
class: Dist::Zilla::Plugin::Git::Check
name: '@RJBS/@Git/Check'
- version: 1.102090
+ version: 1.102810
-
class: Dist::Zilla::Plugin::Git::Commit
name: '@RJBS/@Git/Commit'
- version: 1.102090
+ version: 1.102810
-
class: Dist::Zilla::Plugin::Git::Tag
name: '@RJBS/@Git/Tag'
- version: 1.102090
+ version: 1.102810
-
class: Dist::Zilla::Plugin::Git::Push
name: '@RJBS/@Git/Push'
- version: 1.102090
+ version: 1.102810
-
- class: Dist::Zilla::Plugin::Prereq
+ class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: runtime
type: requires
- name: Prereq
- version: 4.102220
+ name: Prereqs
+ version: 4.102345
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: 4.102220
+ version: 4.102345
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: 4.102220
+ version: 4.102345
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: 0
- version: 4.102220
+ version: 4.102345
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/Makefile.PL Sun Dec 26 00:55:20 2010
@@ -13,7 +13,8 @@
'AUTHOR' => 'Ricardo SIGNES <rjbs at cpan.org>',
'BUILD_REQUIRES' => {
'Test::Deep' => '0',
- 'Test::More' => '0.88'
+ 'Test::Fatal' => '0',
+ 'Test::More' => '0.96'
},
'CONFIGURE_REQUIRES' => {
'ExtUtils::MakeMaker' => '6.31'
@@ -32,11 +33,13 @@
'Params::Util' => '0',
'Scalar::Util' => '0',
'String::Flogger' => '0',
+ 'Sub::Exporter' => '0',
+ 'Sub::Exporter::GlobExporter' => '0.002',
'Sys::Syslog' => '0.16',
'Try::Tiny' => '0.04',
'overload' => '0'
},
- 'VERSION' => '1.102350',
+ 'VERSION' => '2.000',
'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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/README (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/README Sun Dec 26 00:55:20 2010
@@ -1,7 +1,7 @@
This archive contains the distribution Log-Dispatchouli,
-version 1.102350:
+version 2.000:
a simple wrapper around Log::Dispatch
Modified: branches/upstream/liblog-dispatchouli-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/dist.ini?rev=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/dist.ini (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/dist.ini Sun Dec 26 00:55:20 2010
@@ -4,7 +4,6 @@
copyright_holder = Ricardo SIGNES
[@RJBS]
-version = 1
-[Prereq]
+[Prereqs]
Sys::Syslog = 0.16 ; native socket type
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli.pm Sun Dec 26 00:55:20 2010
@@ -2,7 +2,7 @@
use warnings;
package Log::Dispatchouli;
BEGIN {
- $Log::Dispatchouli::VERSION = '1.102350';
+ $Log::Dispatchouli::VERSION = '2.000';
}
# ABSTRACT: a simple wrapper around Log::Dispatch
@@ -115,6 +115,7 @@
$self->{dispatcher} = $log;
$self->{prefix} = $arg->{prefix};
+ $self->{ident} = $ident;
$self->{debug} = exists $arg->{debug}
? ($arg->{debug} ? 1 : 0)
@@ -221,6 +222,9 @@
sub set_prefix { $_[0]->{prefix} = $_[1] }
sub clear_prefix { $_[0]->unset_prefix }
sub unset_prefix { undef $_[0]->{prefix} }
+
+
+sub ident { $_[0]{ident} }
sub new_tester {
@@ -303,7 +307,7 @@
=head1 VERSION
-version 1.102350
+version 2.000
=head1 SYNOPSIS
@@ -452,6 +456,10 @@
This method clears any set logger prefix. (It can also be called as
C<unset_prefix>, but this is deprecated. See L<Logger Prefix|/LOGGER PREFIX>.
+=head2 ident
+
+This method returns the logger's ident.
+
=head2 dispatcher
This returns the underlying Log::Dispatch object. This is not the method
Added: 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=66417&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/lib/Log/Dispatchouli/Global.pm Sun Dec 26 00:55:20 2010
@@ -1,0 +1,210 @@
+use strict;
+use warnings;
+package Log::Dispatchouli::Global;
+BEGIN {
+ $Log::Dispatchouli::Global::VERSION = '2.000';
+}
+# ABSTRACT: a system for sharing a global, dynamically-scoped logger
+
+use Carp ();
+use Log::Dispatchouli;
+use Scalar::Util ();
+
+use Sub::Exporter::GlobExporter 0.002 qw(glob_exporter); # pass-through args
+use Sub::Exporter -setup => {
+ collectors => {
+ '$Logger' => glob_exporter(Logger => \'_build_logger'),
+ },
+};
+
+
+sub logger_globref {
+ no warnings 'once';
+ \*Logger;
+}
+
+sub current_logger {
+ my ($self) = @_;
+
+ my $globref = $self->logger_globref;
+
+ unless (defined $$$globref) {
+ $$$globref = $self->default_logger;
+ }
+
+ return $$$globref;
+}
+
+
+my $default_logger;
+sub default_logger {
+ my ($self) = @_;
+
+ $default_logger ||= $self->default_logger_class->new(
+ $self->default_logger_args
+ );
+}
+
+
+sub default_logger_class { 'Log::Dispatchouli' }
+
+
+sub default_logger_args {
+ return {
+ ident => "default/$0",
+ facility => undef,
+ }
+}
+
+sub _build_logger {
+ my ($self, $arg) = @_;
+
+ my $globref = $self->logger_globref;
+ my $default = $self->default_logger;
+
+ my $Logger = $$$globref;
+
+ if ($arg and $arg->{init}) {
+ if (
+ $Logger
+ and
+ Scalar::Util::refaddr($Logger) != Scalar::Util::refaddr($default)
+ ) {
+ Carp::confess("attempted to initialize $self logger twice");
+ }
+
+ $$$globref = $self->default_logger_class->new($arg->{init});
+ } else {
+ $$$globref ||= $default;
+ }
+
+ return $globref;
+}
+
+1;
+
+__END__
+=pod
+
+=head1 NAME
+
+Log::Dispatchouli::Global - a system for sharing a global, dynamically-scoped logger
+
+=head1 VERSION
+
+version 2.000
+
+=head1 DESCRIPTION
+
+B<Warning>: This interface is still experimental.
+
+Log::Dispatchouli::Global is a framework for a global logger object. In your
+top-level programs that are actually executed, you'd add something like this:
+
+ use Log::Dispatchouli::Global '$Logger' => {
+ init => {
+ ident => 'My::Daemon',
+ facility => 'local2',
+ to_stdout => 1,
+ },
+ };
+
+This will import a C<$Logger> into your program, and more importantly will
+initialize it with a new L<Log::Dispatchouli> object created by passing the
+value for the C<init> parameter to Log::Dispatchouli's C<new> method.
+
+Much of the rest of your program, across various libraries, can then just use
+this:
+
+ use Log::Dispatchouli::Global '$Logger';
+
+ sub whatever {
+ ...
+
+ $Logger->log("about to do something");
+
+ local $Logger = $Logger->proxy({ proxy_prefix => "whatever: " });
+
+ for (@things) {
+ $Logger->log([ "doing thing %s", $_ ]);
+ ...
+ }
+ }
+
+This eliminates the need to pass around what is effectively a global, while
+still allowing it to be specialized withing certain contexts of your program.
+
+B<Warning!> Although you I<could> just use Log::Dispatchouli::Global as your
+shared logging library, you almost I<certainly> want to write a subclass that
+will only be shared amongst your application's classes.
+Log::Dispatchouli::Global is meant to be subclassed and shared only within
+controlled systems. Remember, I<sharing your state with code you don't
+control is dangerous>.
+
+=head1 USING
+
+In general, you will either be using a Log::Dispatchouli::Global class to get
+a C<$Logger> or to initialize it (and then get C<$Logger>). These are both
+demonstrated above. Also, when importing C<$Logger> you may request it be
+imported under a different name:
+
+ use Log::Dispatchouli::Global '$Logger' => { -as => 'L' };
+
+ $L->log( ... );
+
+There is only one class method that you are likely to use: C<current_logger>.
+This provides the value of the shared logger from the caller's context,
+initializing it to a default if needed. Even this method is unlikely to be
+required frequently, but it I<does> allow users to I<see> C<$Logger> without
+importing it.
+
+=head1 SUBCLASSING
+
+Before using Log::Dispatchouli::Global in your application, you should subclass
+it. When you subclass it, you should provide the following methods:
+
+=head2 logger_globref
+
+This method should return a globref in which the shared logger will be stored.
+Subclasses will be in their own package, so barring any need for cleverness,
+every implementation of this method can look like the following:
+
+ sub logger_globref { no warnings 'once'; return \*Logger }
+
+=head2 default_logger
+
+If no logger has been initialized, but something tries to log, it gets the
+default logger, created by calling this method.
+
+The default implementation calls C<new> on the C<default_logger_class> with the
+result of C<default_logger_args> as the arguments.
+
+=head2 default_logger_class
+
+This returns the class on which C<new> will be called when initializing a
+logger, either from the C<init> argument when importing or the default logger.
+
+Its default value is Log::Dispatchouli.
+
+=head2 default_logger_args
+
+If no logger has been initialized, but something tries to log, it gets the
+default logger, created by calling C<new> on the C<default_logger_class> and
+passing the results of calling this method.
+
+Its default return value creates a sink, so that anything logged without an
+initialized logger is lost.
+
+=head1 AUTHOR
+
+Ricardo SIGNES <rjbs at cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2010 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.
+
+=cut
+
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=66417&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 Sun Dec 26 00:55:20 2010
@@ -2,7 +2,7 @@
use warnings;
package Log::Dispatchouli::Proxy;
BEGIN {
- $Log::Dispatchouli::Proxy::VERSION = '1.102350';
+ $Log::Dispatchouli::Proxy::VERSION = '2.000';
}
# ABSTRACT: a simple wrapper around Log::Dispatch
@@ -37,6 +37,8 @@
sub parent { $_[0]{parent} }
sub logger { $_[0]{logger} }
+
+sub ident { $_[0]{logger}->ident }
sub set_prefix { $_[0]{prefix} = $_[1] }
sub get_prefix { $_[0]{prefix} }
@@ -117,7 +119,7 @@
=head1 VERSION
-version 1.102350
+version 2.000
=head1 DESCRIPTION
Modified: branches/upstream/liblog-dispatchouli-perl/current/t/basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/basic.t?rev=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/basic.t (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/basic.t Sun Dec 26 00:55:20 2010
@@ -6,9 +6,14 @@
use Test::Deep;
{
- my $logger = Log::Dispatchouli->new_tester({ log_pid => 1 });
+ my $logger = Log::Dispatchouli->new_tester({
+ log_pid => 1,
+ ident => 't/basic.t',
+ });
isa_ok($logger, 'Log::Dispatchouli');
+
+ is($logger->ident, 't/basic.t', '$logger->ident is available');
$logger->log([ "point: %s", {x=>1,y=>2} ]);
$logger->log_debug('this will not get logged');
Added: branches/upstream/liblog-dispatchouli-perl/current/t/global.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-dispatchouli-perl/current/t/global.t?rev=66417&op=file
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/global.t (added)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/global.t Sun Dec 26 00:55:20 2010
@@ -1,0 +1,54 @@
+use strict;
+use warnings;
+
+use Test::Fatal;
+use Test::More;
+
+use Log::Dispatchouli::Global '$Logger' => { init => {
+ ident => 't/global.t',
+ log_pid => 0,
+ to_self => 1,
+}};
+
+{
+ package Alpha;
+ use Log::Dispatchouli::Global '$Logger';
+
+ sub call_bravo {
+ my ($self, $n) = @_;
+
+ local $Logger = $Logger->proxy({ proxy_prefix => "$n: " });
+
+ $Logger->log("inside call_bravo");
+
+ Bravo->endpoint;
+ }
+}
+
+{
+ package Bravo;
+ use Log::Dispatchouli::Global '$Logger' => { -as => 'L' };
+
+ sub endpoint {
+ my ($self, $n) = @_;
+
+ $L->log("inside Bravo::endpoint");
+ }
+}
+
+isa_ok($Logger, 'Log::Dispatchouli', 'imported $Logger');
+
+$Logger->log("first");
+
+Alpha->call_bravo(123);
+
+$Logger->log("last");
+
+my $events = $Logger->events;
+
+is($events->[0]->{message}, 'first', '1st log');
+is($events->[1]->{message}, '123: inside call_bravo', '2nd log');
+is($events->[2]->{message}, '123: inside Bravo::endpoint', '3rd log');
+is($events->[3]->{message}, 'last', '4th log');
+
+done_testing;
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=66417&op=diff
==============================================================================
--- branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t (original)
+++ branches/upstream/liblog-dispatchouli-perl/current/t/proxy.t Sun Dec 26 00:55:20 2010
@@ -4,7 +4,9 @@
use Log::Dispatchouli;
use Test::More 0.88;
-my $logger = Log::Dispatchouli->new_tester;
+my $logger = Log::Dispatchouli->new_tester({
+ ident => 't/proxy.t',
+});
sub are_events {
my ($comment, $want) = @_;
@@ -16,6 +18,8 @@
}
$logger->log("1");
+
+is($logger->ident, 't/proxy.t', '$logger->ident is available');
are_events("we can log a simple event", [ '1' ]);
@@ -29,6 +33,8 @@
my $proxy = $logger->proxy({
proxy_prefix => 'B: ',
});
+
+is($proxy->ident, 't/proxy.t', '$proxy->ident is available');
$proxy->log("3");
More information about the Pkg-perl-cvs-commits
mailing list