Class
A logging class that prepends a timestamp to each message.
Attributes
Read & Write
Format of the timestamp which is applied to each logged line. The default is "[%Y-%m-%d %H:%M:%S]"
Class Methods
lib/webrick/log.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/webrick/log.rb, line 143
def initialize(log_file=nil, level=nil)
super(log_file, level)
@time_format = "[%Y-%m-%d %H:%M:%S]"
end
Same as BasicLog#initialize
You can set the timestamp format through time_format
Instance Methods
lib/webrick/log.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/webrick/log.rb, line 150
def log(level, data)
tmp = Time.now.strftime(@time_format)
tmp << " " << data
super(level, tmp)
end
Same as BasicLog#log