Class: Ductr::Log::StandardOutput
- Inherits:
-
Object
- Object
- Ductr::Log::StandardOutput
- Defined in:
- lib/ductr/log/outputs/standard_output.rb
Overview
The STDOUT logger output
Direct Known Subclasses
Constant Summary collapse
- SEVERITY_LABELS =
Returns The labels to associate to severity integers.
%w[DEBUG INFO WARN ERROR FATAL ANY].freeze
Instance Method Summary collapse
-
#initialize(formatter, **options) ⇒ StandardOutput
constructor
Creates a logger output instance.
-
#write(severity, prog_name, message) ⇒ void
Writes the log to the STDOUT.
Constructor Details
#initialize(formatter, **options) ⇒ StandardOutput
Creates a logger output instance
20 21 22 23 |
# File 'lib/ductr/log/outputs/standard_output.rb', line 20 def initialize(formatter, **) @formatter = formatter.new @log_device = ::Logger::LogDevice.new $stdout, ** end |
Instance Method Details
#write(severity, prog_name, message) ⇒ void
This method returns an undefined value.
Writes the log to the STDOUT
34 35 36 |
# File 'lib/ductr/log/outputs/standard_output.rb', line 34 def write(severity, prog_name, ) @log_device.write @formatter.call(SEVERITY_LABELS[severity], Time.now, prog_name, ) end |