Bug 22678: Use Koha::Logger for Mojolicious API logger
authorDavid Cook <dcook@prosentient.com.au>
Thu, 25 Aug 2022 23:59:42 +0000 (23:59 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 24 Oct 2022 17:37:02 +0000 (14:37 -0300)
commit490a056f59d0aae52fde84e3450f29b3bc09c87d
tree470dbeb7539e1671175f56520bfd4711970b1498
parentc0920724ee7cc9e85b9459f3d7ca8f79e51840a7
Bug 22678: Use Koha::Logger for Mojolicious API logger

This patch adds Koha::Logger as the Mojolicious logging object
for the API Mojolicious app.

Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Add $c->app->log->debug('DEBUG') and
$c->app->log->warn('WARN') to a API controller like
Koha::REST::V1::Libraries
2. koha-plack --restart kohadev
3. Go to the API route tied to that API controller method
4. Look at /var/log/koha/kohadev/api-error.log
5. Note that 'WARN' appears but 'DEBUG' does not

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Adding a context sub to Koha::Logger to get it working.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Logger.pm
Koha/REST/V1.pm