The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Cookieville::Plugin::AccessLog - Plugin for logging requests

DESCRIPTION

Cookieville::Plugin::AccessLog is a plugin that will log any data used to select, delete, insert or update records in the database. This log will be written using the default log object, with "info" log level.

Below you can see an example log created by this plugin:

  [Fri Jun 20 14:39:51 2014] [info] [Anonymous] GET / {} 200
  [Fri Jun 20 14:39:51 2014] [info] [Anonymous] GET /sources {} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Invalid-Auth-Id] DELETE /Artist/1 {} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Invalid-Auth-Id] PATCH /Artist/1 {} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Invalid-Auth-Id] PUT /Artist {} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Invalid-Auth-Id] GET /Artist/search {"q" => "{}"} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] GET /sources {} 200
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] DELETE /Artist/1 {} 200
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] PUT /Artist {"name" => "Elvis"} 200
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] PATCH /Artist/1 {"url" => "http://mojolicio.us"} 200
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] GET /Artist/search {"q" => "{}"} 200
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] DELETE /CD/1 {} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] PUT /CD {"name" => "Elvis"} 401
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] PATCH /CD/1 {"url" => "http://mojolicio.us"} 404
  [Fri Jun 20 14:39:51 2014] [info] [Some-Long-Auth-Id-12b34acf274] GET /CD/search {"q" => "{}"} 200

The output is taken from the t/plugin-authorize.t unit test.

THE LOG FORMAT IS CURRENTLY EXPERIMENTAL AND WILL CHANGE WITHOUT ANY NOTICE.

SYNOPSIS

This "SYNOPSIS" explains how to enable this plugin in the Cookieville server.

Example MOJO_CONFIG file that will enable this plugin:

  {
    access_log => {},
  }

METHODS

register

This plugin will register a "before_dispatch" hook which will log on Mojo::Transaction::HTTP "finish" event.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org