diff --git a/cpanfile b/cpanfile index 272fa70..15d33e9 100644 --- a/cpanfile +++ b/cpanfile @@ -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: diff --git a/lib/Explain.pm b/lib/Explain.pm index d6b9aac..ab6d8a2 100755 --- a/lib/Explain.pm +++ b/lib/Explain.pm @@ -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 );