View | Details | Raw Unified | Return to bug 16313
Collapse All | Expand All

(-)a/Koha/Logger.pm (-2 / +1 lines)
Lines 118-125 sub AUTOLOAD { Link Here
118
        warn "$method: $line" if $line;
118
        warn "$method: $line" if $line;
119
    }
119
    }
120
    elsif ( $self->{logger}->can($method) ) {    #use log4perl
120
    elsif ( $self->{logger}->can($method) ) {    #use log4perl
121
        $self->{logger}->$method($line);
121
        return $self->{logger}->$method($line);
122
        return 1;
123
    }
122
    }
124
    else {                                       # we should not really get here
123
    else {                                       # we should not really get here
125
        warn "ERROR: Unsupported method $method";
124
        warn "ERROR: Unsupported method $method";
(-)a/t/Koha/Logger.t (-1 / +19 lines)
Lines 161-166 sub overloadLoggerConfigurations { Link Here
161
#### END OF Test for KD976 - Koha::Logger overload configuration for command line scripts verbosity levels ####
161
#### END OF Test for KD976 - Koha::Logger overload configuration for command line scripts verbosity levels ####
162
###############################################################################################################
162
###############################################################################################################
163
163
164
subtest "Return value passthrough", \&returnValuePassthrough;
165
sub returnValuePassthrough {
166
    my ($logger, $log, $retval);
167
168
    $logger = Koha::Logger->get({category => "retval-madness-1"});
169
    $retval = $logger->trace('This is not printed');
170
    $log = t::Koha::Logger::slurpLog('wantArray');
171
    is(scalar(@$log), 0, "No trace written");
172
    is($retval, undef, "Koha::Logger returns undef per Log4perl best practices");
173
    t::Koha::Logger::clearLog();
174
175
    $retval = $logger->error('This is printed');
176
    $log = t::Koha::Logger::slurpLog('wantArray');
177
    is(scalar(@$log), 1, "Error written");
178
    is($retval, 1, "Koha::Logger returns 1 per Log4perl best practices");
179
    t::Koha::Logger::clearLog();
180
}
181
t::Koha::Logger::clearLog();
182
164
sub _loggerBlarbAllLevels {
183
sub _loggerBlarbAllLevels {
165
    my ($logger) = @_;
184
    my ($logger) = @_;
166
    $logger->trace('trace');
185
    $logger->trace('trace');
167
- 

Return to bug 16313