[Moose-commits] r7852 - in MooseX-LogDispatch/trunk: lib/MooseX t
jrockway at code2.0beta.co.uk
jrockway at code2.0beta.co.uk
Sat Mar 14 03:18:46 GMT 2009
Author: jrockway
Date: 2009-03-13 20:18:45 -0700 (Fri, 13 Mar 2009)
New Revision: 7852
Added:
MooseX-LogDispatch/trunk/t/04-no-config.t
Modified:
MooseX-LogDispatch/trunk/lib/MooseX/LogDispatch.pm
Log:
don't require the provided logger to be a ::Config instance, normal L::D is fine
Modified: MooseX-LogDispatch/trunk/lib/MooseX/LogDispatch.pm
===================================================================
--- MooseX-LogDispatch/trunk/lib/MooseX/LogDispatch.pm 2009-03-13 18:08:54 UTC (rev 7851)
+++ MooseX-LogDispatch/trunk/lib/MooseX/LogDispatch.pm 2009-03-14 03:18:45 UTC (rev 7852)
@@ -27,7 +27,7 @@
has logger => (
- isa => 'Log::Dispatch::Config',
+ isa => 'Log::Dispatch',
is => 'rw',
lazy_build => 1,
);
Added: MooseX-LogDispatch/trunk/t/04-no-config.t
===================================================================
--- MooseX-LogDispatch/trunk/t/04-no-config.t (rev 0)
+++ MooseX-LogDispatch/trunk/t/04-no-config.t 2009-03-14 03:18:45 UTC (rev 7852)
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+my $log;
+
+{ package Logger;
+ use base 'Log::Dispatch::Null';
+ sub log_message {
+ my $self = shift;
+ my %args = @_;
+ $log = $args{message};
+ };
+}
+
+{ package Class;
+ use Moose;
+ with 'MooseX::LogDispatch::Levels';
+
+ sub msg { $_[0]->debug('hello') }
+}
+
+my $logger = Log::Dispatch->new;
+isa_ok $logger, 'Log::Dispatch';
+$logger->add(Logger->new( min_level => 'debug', name => 'foo' ));
+
+my $class = Class->new( logger => $logger );
+isa_ok $class, 'Class';
+
+$class->msg;
+
+is $log, 'hello', 'logging worked';
+
More information about the Moose-commits
mailing list