Masahiro Nagano > Plack-Middleware-AxsLog-0.02 > Plack::Middleware::AxsLog

Download:
Plack-Middleware-AxsLog-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: Plack-Middleware-AxsLog-0.21

NAME ^

Plack::Middleware::AxsLog - Fixed format but Fast AccessLog Middleware

SYNOPSIS ^

  use Plack::Builder;

  builder {
      enable 'AxsLog',
        combined => 1,
        response_time => 1,
        error_only => 1,
      $app
  };

DESCRIPTION ^

Alternative implementation of Plack::Middleware::AccessLog. Only supports combined and common format, but 3x-4x faster than Plack::Middleware::AccessLog in micro benchmarking. AxsLog also supports filter logs by response_time and status code.

LOG FORMAT ^

AxsLog supports combined and common format. And adds elapsed time in microseconds to last of log line

combined (NCSA extended/combined log format)
  %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %D
  => 127.0.0.1 - - [23/Aug/2012:00:52:15 +0900] "GET / HTTP/1.1" 200 645 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1" 10941
common (Common Log Format)
  %h %l %u %t \"%r\" %>s %b %D 
  => 127.0.0.1 - - [23/Aug/2012:00:52:15 +0900] "GET / HTTP/1.0" 200 645 10941

CONFIGURATION ^

combined: Bool

log format. if disabled, "common" format used. default: 1 (combined format used)

response_time: Bool

Adds time to serve the request. default: 0

error_only: Bool

Display logs if response status is error (4xx or 5xx). default: 0

long_response_time: Int (microseconds)

Display log if time to serve the request is above long_response_time. default: 0 (all request logged)

logger: Coderef

Callback to print logs. default:none ( output to psgi.errors )

  use File::RotateLogs;
  my $logger = File::RotateLogs->new();

  builder {
      enable 'AxsLog',
        logger => sub { $logger->print(@_) }
      $app
  };

AUTHOR ^

Masahiro Nagano <kazeburo {at} gmail.com>

SEE ALSO ^

Plack::Middleware::AccessLog

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: