Class: WEBrick::Log

Inherits:
BasicLog show all
Defined in:
lib/webrick/log.rb

Instance Attribute Summary collapse

Attributes inherited from BasicLog

#level

Instance Method Summary collapse

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_formatObject

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