From: John Napiorkowski Date: Wed, 6 Aug 2014 14:37:48 +0000 (-0400) Subject: change default log level to info X-Git-Tag: 5.90070~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=310c2a39c86dc3f8a1dd0bb80c2543e809e2cb3c change default log level to info --- diff --git a/Changes b/Changes index ecc4291..11a177d 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ # This file documents the revision history for Perl extension Catalyst. -5.90069_TBA +5.90069_003 + - The default log level is now 'info', not 'debug'. - Finished merging all the encoding plugin code to core code. The encoding plugin is now just an empty package. Also tried to improve encoding docs a bit. diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index e70197f..72ae936 100755 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -66,8 +66,7 @@ around new => sub { my $class = shift; my $self = $class->$orig; - $self->levels( scalar(@_) ? @_ : keys %LEVELS ); - + $self->levels( scalar(@_) ? @_ : (qw/info warn error fatal/) ); return $self; }; diff --git a/t/aggregate/unit_core_setup.t b/t/aggregate/unit_core_setup.t index c0e6230..3b778f4 100644 --- a/t/aggregate/unit_core_setup.t +++ b/t/aggregate/unit_core_setup.t @@ -70,7 +70,7 @@ foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) { ok $log->is_error, 'Errors should be enabled'; ok $log->is_fatal, 'Fatal errors should be enabled'; ok $log->is_info, 'Info should be enabled'; - ok $log->is_debug, 'Debugging should be enabled'; + ok !$log->is_debug, 'Debugging should not be enabled'; ok !$c->debug, 'Catalyst debugging turned off'; } my $log_meta = Class::MOP::Class->create_anon_class( diff --git a/t/aggregate/unit_core_setup_log.t b/t/aggregate/unit_core_setup_log.t index fb73297..9e80cf4 100644 --- a/t/aggregate/unit_core_setup_log.t +++ b/t/aggregate/unit_core_setup_log.t @@ -76,13 +76,13 @@ foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) { my $app = mock_app('TestAppLogEmptyString'); $app->setup_log(''); ok !$app->debug, 'Not In debug mode'; - # Note that by default, you get _all_ the log levels turned on + # Note that by default, you get _all_ the log levels turned on over debug test_log_object($app->log, fatal => 1, error => 1, warn => 1, info => 1, - debug => 1, + debug => 0, ); } { diff --git a/t/lib/TestApp/Controller/Log.pm b/t/lib/TestApp/Controller/Log.pm index 1a8cf0a..7bed663 100644 --- a/t/lib/TestApp/Controller/Log.pm +++ b/t/lib/TestApp/Controller/Log.pm @@ -9,6 +9,11 @@ sub debug :Local { $c->res->body( 'logged' ); } +sub info :Local { + my ( $self, $c ) = @_; + $c->log->info('info'); + $c->res->body( 'logged' ); +} 1; diff --git a/t/psgi-log.t b/t/psgi-log.t index 9e269c3..56b9dad 100644 --- a/t/psgi-log.t +++ b/t/psgi-log.t @@ -69,10 +69,10 @@ my $cmp = TestApp->debug ? '>=' : '=='; test_psgi $app, sub { my $cb = shift; - my $res = $cb->(GET "/log/debug"); + my $res = $cb->(GET "/log/info"); my @logs = $handle->logs; cmp_ok(scalar(@logs), $cmp, 1, "psgi.errors: one event output"); - like($logs[0], qr/debug$/m, "psgi.errors: event matches test data"); + like($logs[0], qr/info$/m, "psgi.errors: event matches test data"); }; }; @@ -97,9 +97,9 @@ my $cmp = TestApp->debug ? '>=' : '=='; test_psgi $app, sub { my $cb = shift; - my $res = $cb->(GET "/log/debug"); + my $res = $cb->(GET "/log/info"); cmp_ok(scalar(@logs), $cmp, 1, "psgix.logger: one event logged"); - is(scalar(grep { $_->{level} eq 'debug' and $_->{message} eq 'debug' } @logs), + is(scalar(grep { $_->{level} eq 'info' and $_->{message} eq 'info' } @logs), 1, "psgix.logger: right stuff"); }; };