From: David Kamholz Date: Mon, 6 Nov 2006 18:11:04 +0000 (+0000) Subject: tweak debug output slightly X-Git-Tag: 5.7099_04~294 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=1cf0345be8d7bf7cd33467da529885068db2b710 tweak debug output slightly --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2a85d29..b9d6bef 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -817,6 +817,7 @@ You are running an old script! or (this will not overwrite existing files): catalyst.pl -scripts $class + EOF } @@ -826,7 +827,7 @@ EOF if (@plugins) { my $t = Text::SimpleTable->new(74); $t->row($_) for @plugins; - $class->log->debug( "Loaded plugins:\n" . $t->draw ); + $class->log->debug( "Loaded plugins:\n" . $t->draw . "\n" ); } my $dispatcher = $class->dispatcher; @@ -861,7 +862,7 @@ EOF my $type = ref $class->components->{$comp} ? 'instance' : 'class'; $t->row( $comp, $type ); } - $class->log->debug( "Loaded components:\n" . $t->draw ) + $class->log->debug( "Loaded components:\n" . $t->draw . "\n" ) if ( keys %{ $class->components } ); } @@ -1327,7 +1328,7 @@ sub finalize { ); $c->log->info( - "Request took ${elapsed}s ($av/s)\n" . $t->draw ); + "Request took ${elapsed}s ($av/s)\n" . $t->draw . "\n" ); } return $c->response->status; diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index d55d22d..d637db7 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -85,7 +85,7 @@ sub list { $paths->row(@$_) for @rows; } - $c->log->debug( "Loaded Path Part actions:\n" . $paths->draw ); + $c->log->debug( "Loaded Chained actions:\n" . $paths->draw . "\n" ); } =head2 $self->match( $c, $path ) diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index 52fdb73..d832dce 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -32,7 +32,7 @@ sub list { $paths->row( $display_path, "/$action" ); } } - $c->log->debug( "Loaded Path actions:\n" . $paths->draw ) + $c->log->debug( "Loaded Path actions:\n" . $paths->draw . "\n" ) if ( keys %{ $self->{paths} } ); } diff --git a/lib/Catalyst/DispatchType/Regex.pm b/lib/Catalyst/DispatchType/Regex.pm index 3fbc04c..80b9f2f 100644 --- a/lib/Catalyst/DispatchType/Regex.pm +++ b/lib/Catalyst/DispatchType/Regex.pm @@ -30,7 +30,7 @@ sub list { my $action = $regex->{action}; $re->row( $regex->{path}, "/$action" ); } - $c->log->debug( "Loaded Regex actions:\n" . $re->draw ) + $c->log->debug( "Loaded Regex actions:\n" . $re->draw . "\n" ) if ( @{ $self->{compiled} } ); } diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 29cf4ec..7f201c2 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -500,8 +500,8 @@ sub setup_actions { }; $walker->( $walker, $self->tree, '' ); - $c->log->debug( "Loaded Private actions:\n" . $privates->draw ) - if ($has_private); + $c->log->debug( "Loaded Private actions:\n" . $privates->draw . "\n" ) + if $has_private; # List all public actions $_->list($c) for @{ $self->dispatch_types }; diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index 616a678..822ea32 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -69,7 +69,8 @@ sub _log { my $self = shift; my $level = shift; my $message = join( "\n", @_ ); - $self->{body} .= sprintf( "[%s] %s\n", $level, $message ); + $message .= "\n" unless $message =~ /\n$/; + $self->{body} .= sprintf( "[%s] %s", $level, $message ); } sub _flush {