Class: WEBrick::Log
Instance Attribute Summary collapse
-
#time_format ⇒ Object
Returns the value of attribute time_format.
Attributes inherited from BasicLog
Instance Method Summary collapse
-
#initialize(log_file = nil, level = nil) ⇒ Log
constructor
A new instance of Log.
- #log(level, data) ⇒ Object
Methods inherited from BasicLog
#<<, #close, #debug, #debug?, #error, #error?, #fatal, #fatal?, #info, #info?, #warn, #warn?
Constructor Details
#initialize(log_file = nil, level = nil) ⇒ Log
Returns a new instance of Log.
77 78 79 80 |
# File 'lib/webrick/log.rb', line 77 def initialize(log_file=nil, level=nil) super(log_file, level) @time_format = "[%Y-%m-%d %H:%M:%S]" end |
Instance Attribute Details
#time_format ⇒ Object
Returns the value of attribute time_format.
75 76 77 |
# File 'lib/webrick/log.rb', line 75 def time_format @time_format end |
Instance Method Details
#log(level, data) ⇒ Object
82 83 84 85 86 |
# File 'lib/webrick/log.rb', line 82 def log(level, data) tmp = Time.now.strftime(@time_format) tmp << " " << data super(level, tmp) end |