Bugzilla – Attachment 155359 Details for
Bug 34271
Remove a few Logger statements from REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34271: Remove a few Logger statements from REST API
Bug-34271-Remove-a-few-Logger-statements-from-REST.patch (text/plain), 3.28 KB, created by
David Cook
on 2023-09-08 06:54:14 UTC
(
hide
)
Description:
Bug 34271: Remove a few Logger statements from REST API
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-09-08 06:54:14 UTC
Size:
3.28 KB
patch
obsolete
>From a7c980c1bcf2c5d9d90303ddb9e4f14b9ee0be05 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 13 Jul 2023 14:23:22 +0000 >Subject: [PATCH] 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> >--- > Koha/REST/V1.pm | 8 +++----- > Koha/REST/V1/OAuth/Client.pm | 7 ++----- > 2 files changed, 5 insertions(+), 10 deletions(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index cfb7a597f4..59f8f88e34 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -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' ); >diff --git a/Koha/REST/V1/OAuth/Client.pm b/Koha/REST/V1/OAuth/Client.pm >index b6f66b022c..ad15a87967 100644 >--- a/Koha/REST/V1/OAuth/Client.pm >+++ b/Koha/REST/V1/OAuth/Client.pm >@@ -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"); > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34271
:
153399
|
155359
|
157236