Jifty-Plugin-AccessLog
view release on metacpan or search on metacpan
lib/Jifty/Plugin/AccessLog.pm view on Meta::CPAN
=head2 OPTIONS
=over 4
=item path
The file to log to; defaults to F<log/access_log>.
=item respect_proxy
If set to a true value, will display the C<X-Forwarded-For> header as
the originating IP of requests.
=item format
The format string to use when logging. This module attempts to be as
Apache-compatible as possible; it supports the following format
escapes:
=over
lib/Jifty/Plugin/AccessLog.pm view on Meta::CPAN
return sub {
my @a = grep { $_->active } $r->actions;
return "-" unless @a;
( $r->just_validating ? "V" : "" ) . "<" . join(
", ", map {$one_action->($_)} @a) . ">";
}
};
my %ESCAPES = (
'%' => sub { '%' },
a => sub { ($self->respect_proxy && $r->header("X-Forwarded-For")) || $r->address },
C => sub { my $c = { CGI::Cookie->fetch() }->{+shift}; $c ? $c->value : undef },
D => sub { sprintf "%.3fms", (Time::HiRes::time - $self->start)*1000 },
e => sub { $r->env->{+shift} },
h => sub { ($self->respect_proxy && $r->header("X-Forwarded-For")) || $r->remote_host || $r->address },
i => sub { $r->header(shift) },
l => sub { substr( Jifty->web->session->id || '-', 0, 8 ) },
m => sub { $r->method },
n => sub { $r->template_argument($_[0]) || $r->argument($_[0]) },
o => sub { Jifty->web->response->header(shift) },
p => sub {
return Jifty->config->framework("Web")->{Port} if $_[0] eq "canonical";
return $r->env->{SERVER_PORT} if $_[0] eq "local";
return $r->env->{REMOTE_PORT} if $_[0] eq "remote";
return Jifty->config->framework("Web")->{Port};
( run in 0.903 second using v1.01-cache-2.11-cpan-26ccb49234f )