Class: LibvirtAsync::LogFormatter
- Inherits:
-
Object
- Object
- LibvirtAsync::LogFormatter
- Defined in:
- lib/libvirt_async/log_formatter.rb
Constant Summary collapse
- LOG_FORMAT =
"%s, %s [%d/%s/%s] %s\n".freeze
- DEFAULT_DATETIME_FORMAT =
"%F %T.%N".freeze
Instance Attribute Summary collapse
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
Instance Method Summary collapse
- #call(severity, time, progname, message) ⇒ Object
-
#initialize ⇒ LogFormatter
constructor
A new instance of LogFormatter.
Constructor Details
#initialize ⇒ LogFormatter
Returns a new instance of LogFormatter.
10 11 12 |
# File 'lib/libvirt_async/log_formatter.rb', line 10 def initialize @datetime_format = nil end |
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
8 9 10 |
# File 'lib/libvirt_async/log_formatter.rb', line 8 def datetime_format @datetime_format end |
Instance Method Details
#call(severity, time, progname, message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/libvirt_async/log_formatter.rb', line 14 def call(severity, time, progname, ) LOG_FORMAT % [ severity[0..0], format_datetime(time), Process.pid, "0x#{Fiber.current.object_id.to_s(16)}", progname, () ] end |