Skip to content

Commit

Permalink
Use ' instead of " for readability, and to avoid inadvertent interpol…
Browse files Browse the repository at this point in the history
…ation of % characters
  • Loading branch information
karenetheridge committed Apr 2, 2012
1 parent ac93111 commit dfb82c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Plack/Middleware/AccessLog.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use Carp ();
use Plack::Util;

my %formats = (
common => "%h %l %u %t \"%r\" %>s %b",
combined => "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"",
common => '%h %l %u %t "%r" %>s %b',
combined => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"',
);

use POSIX ();
Expand Down Expand Up @@ -64,7 +64,7 @@ sub log_line {
h => sub { $env->{REMOTE_ADDR} || '-' },
l => sub { '-' },
u => sub { $env->{REMOTE_USER} || '-' },
t => sub { "[" . $strftime->("%d/%b/%Y:%H:%M:%S %z", localtime) . "]" },
t => sub { "[" . $strftime->('%d/%b/%Y:%H:%M:%S %z', localtime) . "]" },
r => sub { _safe($env->{REQUEST_METHOD}) . " " . _safe($env->{REQUEST_URI}) .
" " . $env->{SERVER_PROTOCOL} },
s => sub { $status },
Expand Down Expand Up @@ -151,7 +151,7 @@ default C<development> environment.
=item format
enable "Plack::Middleware::AccessLog",
format => "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"";
format => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"';
Takes a format string (or a preset template C<combined> or C<custom>)
to specify the log format. This middleware implements a subset of
Expand Down

0 comments on commit dfb82c2

Please sign in to comment.