1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2024-11-24 08:42:27 +02:00

Bring back log

This was removed by change in Mojolicious. While doing it, make it
autorotate every day.
This commit is contained in:
Hubert depesz Lubaczewski 2023-12-27 13:46:17 +01:00
parent 937cf53ddc
commit 14428d818f
2 changed files with 8 additions and 0 deletions

View File

@ -21,5 +21,6 @@ requires 'Mojolicious';
requires 'Pg::Explain', '>= 2.4';
requires 'Number::Bytes::Human';
requires 'Pg::SQL::PrettyPrinter';
requires 'MojoX::Log::Rotate'
# vim: set ft=perl:

View File

@ -1,10 +1,17 @@
package Explain;
use Mojo::Base 'Mojolicious';
use MojoX::Log::Rotate;
sub startup {
my $self = shift;
my $log = MojoX::Log::Rotate->new(
'path' => $self->home->child( 'log', $self->mode . '.log' ),
'frequency' => 86400
);
$self->log( $log );
$self->sessions->cookie_name( 'explain' );
$self->sessions->default_expiration( 60 * 60 * 24 * 365 );