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;
};
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';
}
$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,
);
}
$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,
);
}