diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-24 13:23:32 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-12-24 13:28:57 -0800 |
commit | 9b46379f75f384c86e42046ab03ce55231197c92 (patch) | |
tree | 33ffd8703db04f1bc299df03f12673fda2f888c7 /lib/clogger/pure.rb | |
parent | 8d58b42d0255880d732ba0700597b312a8219f8f (diff) | |
download | clogger-9b46379f75f384c86e42046ab03ce55231197c92.tar.gz |
This lessens confusion for people configuring Clogger in config.ru, since "File" could be mistaken for Rack::File and "::File" needs to be specified.
Diffstat (limited to 'lib/clogger/pure.rb')
-rw-r--r-- | lib/clogger/pure.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb index 0dd5021..452e232 100644 --- a/lib/clogger/pure.rb +++ b/lib/clogger/pure.rb @@ -14,7 +14,12 @@ class Clogger @app = app @logger = opts[:logger] - (@logger.sync = true) rescue nil + path = opts[:path] + path && @logger and + raise ArgumentError, ":logger and :path are independent" + path and @logger = File.open(path, "ab") + + @logger.sync = true if @logger.respond_to?(:sync=) @fmt_ops = compile_format(opts[:format] || Format::Common, opts) @wrap_body = need_wrap_body?(@fmt_ops) @reentrant = opts[:reentrant] @@ -69,7 +74,7 @@ class Clogger end def fileno - @logger.fileno rescue nil + @logger.respond_to?(:fileno) ? @logger.fileno : nil end private |