--- /dev/null
+package Newslash::Plugin::RequestLogger;
+use Mojo::Base 'Mojolicious::Plugin';
+use Data::Dumper;
+
+use constant KEY_PREFIX => 'ns_reqlog';
+
+sub register {
+ my ($self, $app, $conf) = @_;
+ my $r_opts = $app->config->{RequestLogger} || {};
+ my $opts = $conf->{options} || {};
+
+ $self->{options} = {%$opts, %$r_opts};
+ $self->{app} = $app;
+ $app->helper(request_logger => sub { state $request_logger = $self; });
+
+ $app->hook(after_dispatch => sub {
+ my $c = shift;
+ my $m = $c->match;
+ my $stack = pop $m->stack->[-1];
+
+ if ($stack->{content_path}) {
+ # static_contents
+ # log content_path
+ return;
+ }
+ if ($stack->{action}) {
+ # action
+ # log action, controller, etc. params
+ }
+ });
+}
+
+
+
+1;