21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/rack/ltsvlogger.rb', line 21
def log(env, status, , began_at)
now = Time.now
length = ()
logger = @logger || env['rack.errors']
logger.write FORMAT % {
time: now.strftime("%d/%b/%Y %H:%M:%S"),
host: env["REMOTE_ADDR"] || "-",
forwardedfor: env['HTTP_X_FORWARDED_FOR'] || "-",
user: env["REMOTE_USER"] || "-",
method: env["REQUEST_METHOD"],
path: env["PATH_INFO"],
query: env["QUERY_STRING"].empty? ? "" : "?"+env["QUERY_STRING"],
protocol: env["HTTP_VERSION"],
status: status.to_s[0..3],
size: length,
runtime: now - began_at,
}
end
|