Bug 34271: Remove a few Logger statements from REST API
See also bug 22678.
We should call app->log->warn, ->debug, etc. instead of Logger.
Test plan:
The simplest way I tested V1, is add a app->log->warn in the try
blocks, restart all and check that your log4perl is set correctly
too.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a3ce05012b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
1de535046a
commit
c2f1a41670
|
|
@ -109,8 +109,7 @@ sub startup {
|
|||
# to catch bad ones.
|
||||
|
||||
# JSON::Validator uses confess, so trim call stack from the message.
|
||||
my $logger = Koha::Logger->get({ interface => 'api' });
|
||||
$logger->error("Warning: Could not load REST API spec bundle: " . $_);
|
||||
$self->app->log->error("Warning: Could not load REST API spec bundle: " . $_);
|
||||
|
||||
try {
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ sub startup {
|
|||
}
|
||||
catch {
|
||||
# JSON::Validator uses confess, so trim call stack from the message.
|
||||
$logger->error("Warning: Could not load REST API spec bundle: " . $_);
|
||||
$self->app->log->error("Warning: Could not load REST API spec bundle: " . $_);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -148,8 +147,7 @@ sub startup {
|
|||
$oauth_configuration->{ $provider->code } = decode_json( $provider->config );
|
||||
}
|
||||
} catch {
|
||||
my $logger = Koha::Logger->get( { interface => 'api' } );
|
||||
$logger->warn( "Warning: Failed to fetch oauth configuration: " . $_ );
|
||||
$self->app->log->warn( "Warning: Failed to fetch oauth configuration: " . $_ );
|
||||
};
|
||||
|
||||
$self->plugin( 'Koha::REST::Plugin::Pagination' );
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ use Mojo::Base 'Mojolicious::Controller';
|
|||
use Mojo::URL;
|
||||
use Scalar::Util qw(blessed);
|
||||
use Try::Tiny;
|
||||
use Koha::Logger;
|
||||
use Koha::Token;
|
||||
use URI::Escape qw(uri_escape_utf8);
|
||||
|
||||
|
|
@ -47,8 +46,6 @@ sub login {
|
|||
my $provider = $c->param('provider_code');
|
||||
my $interface = $c->param('interface');
|
||||
|
||||
my $logger = Koha::Logger->get({ interface => 'api' });
|
||||
|
||||
my $provider_config = $c->oauth2->providers->{$provider};
|
||||
|
||||
my $uri;
|
||||
|
|
@ -132,7 +129,7 @@ sub login {
|
|||
$c->redirect_to($uri);
|
||||
} catch {
|
||||
my $error = $_;
|
||||
$logger->error($error);
|
||||
$c->app->log->error($error);
|
||||
# TODO: Review behavior
|
||||
if ( blessed $error ) {
|
||||
if ( $error->isa('Koha::Exceptions::Auth::Unauthorized') ) {
|
||||
|
|
@ -151,7 +148,7 @@ sub login {
|
|||
)->catch(
|
||||
sub {
|
||||
my $error = shift;
|
||||
$logger->error($error);
|
||||
$c->app->log->error($error);
|
||||
$error = uri_escape_utf8($error);
|
||||
$c->redirect_to($uri."?auth_error=$error");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue