[Catalyst-commits] r9804 - in Catalyst-Runtime/5.80/trunk: lib/Catalyst t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Apr 23 00:45:06 GMT 2009


Author: caelum
Date: 2009-04-23 01:45:06 +0100 (Thu, 23 Apr 2009)
New Revision: 9804

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
   Catalyst-Runtime/5.80/trunk/t/unit_core_setup.t
   Catalyst-Runtime/5.80/trunk/t/unit_core_setup_log.t
Log:
runtime: fix logging with -Debug

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm	2009-04-22 22:44:46 UTC (rev 9803)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm	2009-04-23 00:45:06 UTC (rev 9804)
@@ -42,7 +42,13 @@
     my $orig = shift;
     my $class = shift;
     my $self = $class->$orig;
-    $self->levels( scalar(@_) ? @_ : keys %LEVELS );
+
+    if (@_ == 1 && $_[0] eq 'debug') {
+        $self->levels( keys %LEVELS );
+    } else {
+        $self->levels( scalar(@_) ? @_ : keys %LEVELS );
+    }
+
     return $self;
 };
 

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_setup.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_setup.t	2009-04-22 22:44:46 UTC (rev 9803)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_setup.t	2009-04-23 00:45:06 UTC (rev 9804)
@@ -31,10 +31,10 @@
     ok my $c = MyTestDebug->new, 'Get debug app object';
     ok my $log = $c->log, 'Get log object';
     isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
-    ok !$log->is_warn, 'Warnings should be disabled';
-    ok !$log->is_error, 'Errors should be disabled';
-    ok !$log->is_fatal, 'Fatal errors should be disabled';
-    ok !$log->is_info, 'Info should be disabled';
+    ok $log->is_warn, 'Warnings should be enabled';
+    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 $app->debug, 'debug method should return true';
 }

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_setup_log.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_setup_log.t	2009-04-22 22:44:46 UTC (rev 9803)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_setup_log.t	2009-04-23 00:45:06 UTC (rev 9804)
@@ -49,10 +49,10 @@
     $app->setup_log('');
     ok $app->debug, 'In debug mode';
     test_log_object($app->log,
-        fatal => 0,
-        error => 0,
-        warn => 0,
-        info => 0,
+        fatal => 1,
+        error => 1,
+        warn => 1,
+        info => 1,
         debug => 1,
     );
 }
@@ -89,10 +89,10 @@
     $app->setup_log('debug');
     ok $app->debug, 'In debug mode';
     test_log_object($app->log,
-        fatal => 0,
-        error => 0,
-        warn => 0,
-        info => 0,
+        fatal => 1,
+        error => 1,
+        warn => 1,
+        info => 1,
         debug => 1,
     );
 }




More information about the Catalyst-commits mailing list