NAME
PAGI::Middleware::AccessLog - Request logging middleware
SYNOPSIS
use PAGI::Middleware::Builder;
my $app = builder {
enable 'AccessLog',
logger => sub { print STDERR @_ },
format => 'combined';
$my_app;
};
DESCRIPTION
PAGI::Middleware::AccessLog logs HTTP requests in configurable formats. It captures client IP, method, path, status, response size, and timing.
CONFIGURATION
logger (default: warns to STDERR)
A coderef that receives the formatted log line.
format (default: 'combined')
Log format: 'combined', 'common', or 'tiny'.
LOG FORMATS
combined (default)
Apache/nginx combined log format:
127.0.0.1 - - [01/Jan/2024:12:00:00 +0000] "GET /path HTTP/1.1" 200 1234 "-" "Mozilla/5.0" 0.005s
common
Apache common log format:
127.0.0.1 - - [01/Jan/2024:12:00:00 +0000] "GET /path HTTP/1.1" 200 1234
tiny
Minimal format:
GET /path 200 0.005s
SEE ALSO
PAGI::Middleware - Base class for middleware