change default log level to info
John Napiorkowski [Wed, 6 Aug 2014 14:37:48 +0000 (10:37 -0400)]
Changes
lib/Catalyst/Log.pm
t/aggregate/unit_core_setup.t
t/aggregate/unit_core_setup_log.t
t/lib/TestApp/Controller/Log.pm
t/psgi-log.t

diff --git a/Changes b/Changes
index ecc4291..11a177d 100644 (file)
--- 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.
index e70197f..72ae936 100755 (executable)
@@ -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;
 };
 
index c0e6230..3b778f4 100644 (file)
@@ -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(
index fb73297..9e80cf4 100644 (file)
@@ -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,
     );
 }
 {
index 1a8cf0a..7bed663 100644 (file)
@@ -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;
 
index 9e269c3..56b9dad 100644 (file)
@@ -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");
     };
 };