Class: WEBrick::Log
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/webrick-1.7.0/lib/webrick/log.rb
Overview
A logging class that prepends a timestamp to each message.
Constant Summary
Constants inherited from BasicLog
BasicLog::DEBUG, BasicLog::ERROR, BasicLog::FATAL, BasicLog::INFO, BasicLog::WARN
Instance Attribute Summary collapse
-
#time_format ⇒ Object
Format of the timestamp which is applied to each logged line.
Attributes inherited from BasicLog
Instance Method Summary collapse
-
#initialize(log_file = nil, level = nil) ⇒ Log
constructor
Same as BasicLog#initialize.
-
#log(level, data) ⇒ Object
Same as BasicLog#log.
Methods inherited from BasicLog
#<<, #close, #debug, #debug?, #error, #error?, #fatal, #fatal?, #info, #info?, #warn, #warn?
Constructor Details
#initialize(log_file = nil, level = nil) ⇒ Log
Same as BasicLog#initialize
You can set the timestamp format through #time_format
143 144 145 146 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/webrick-1.7.0/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 |
Instance Attribute Details
#time_format ⇒ Object
Format of the timestamp which is applied to each logged line. The default is "[%Y-%m-%d %H:%M:%S]"
137 138 139 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/webrick-1.7.0/lib/webrick/log.rb', line 137 def time_format @time_format end |