From 5580514d1b291217ccfd62f2f1b06f64aa3906ef Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 14 Jan 2011 16:30:38 -0800 Subject: properly support $time_utc as documented nginx doesn't have this, only time_local, but we do --- lib/clogger.rb | 1 + test/test_clogger.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/clogger.rb b/lib/clogger.rb index 75a639c..170dd21 100644 --- a/lib/clogger.rb +++ b/lib/clogger.rb @@ -23,6 +23,7 @@ class Clogger ALIASES = { '$request_time' => '$request_time{3}', '$time_local' => '$time_local{%d/%b/%Y:%H:%M:%S %z}', + '$time_utc' => '$time_utc{%d/%b/%Y:%H:%M:%S %z}', '$msec' => '$time{3}', '$usec' => '$time{6}', '$http_content_length' => '$content_length', diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 2cd895c..40c9190 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -689,4 +689,12 @@ class TestClogger < Test::Unit::TestCase status, headers, body = cl.call(@req) assert_equal expect, s[0] end + + def test_time_utc + s = [] + app = lambda { |env| [200, [], [] ] } + cl = Clogger.new(app, :logger => s, :format => "$time_utc") + status, headers, body = cl.call(@req) + assert %r!\A\d+/\w+/\d{4}:\d\d:\d\d:\d\d \+0000\n\z! =~ s[0], s.inspect + end end -- cgit v1.2.3-24-ge0c7