Changeset 34035
- Timestamp:
- 06/19/09 02:14:32 (4 years ago)
- Location:
- lang/perl/Log-Dispatch-Colorful/trunk
- Files:
-
- 2 modified
-
lib/Log/Dispatch/Colorful.pm (modified) (2 diffs)
-
t/01_log.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Log-Dispatch-Colorful/trunk/lib/Log/Dispatch/Colorful.pm
r25943 r34035 18 18 19 19 BEGIN { 20 foreach my $l (qw( debug info notice warning err error crit critical alert emerg emergency )) {20 foreach my $level (qw( debug info notice warning err error crit critical alert emerg emergency )) { 21 21 my $sub = sub { 22 22 my $self = shift; … … 24 24 foreach my $arg (@_) { 25 25 if ( ref $arg ) { 26 $ arg= Dumper($arg);26 $messages = Dumper($arg); 27 27 } 28 28 $messages .= $arg || ''; 29 29 } 30 30 31 $self->log( level => $l , message => $messages );31 $self->log( level => $level, message => $messages ); 32 32 }; 33 33 34 $LEVELS{$l } = 1;34 $LEVELS{$level} = 1; 35 35 36 36 no strict 'refs'; 37 37 no warnings 'redefine'; 38 *{ "Log::Dispatch::" . $l } = $sub;38 *{ "Log::Dispatch::" . $level } = $sub; 39 39 } 40 40 } -
lang/perl/Log-Dispatch-Colorful/trunk/t/01_log.t
r24553 r34035 2 2 use warnings; 3 3 4 use Test::More tests => 2;4 use Test::More tests => 4; 5 5 6 6 use Log::Dispatch; … … 37 37 38 38 my $data = { foo => 'bar' }; 39 is ref $data, 'HASH'; 40 39 41 $dispatcher->debug($data); 40 42 41 43 ok $err =~ m!'foo' \s+ => \s+ 'bar'!xms, 'no debug'; 44 is ref $data, 'HASH'; 42 45
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)