Class: LogSinks::RubyLoggerAdapter
- Inherits:
-
Object
- Object
- LogSinks::RubyLoggerAdapter
- Defined in:
- lib/log_sinks/ruby_logger_adapter.rb
Overview
Adapter for [LogSinks::Logger] to match [::Logger] interface.
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil, &block) ⇒ Object
-
#initialize(logger, progname) ⇒ RubyLoggerAdapter
constructor
A new instance of RubyLoggerAdapter.
Constructor Details
#initialize(logger, progname) ⇒ RubyLoggerAdapter
Returns a new instance of RubyLoggerAdapter.
40 41 42 43 44 |
# File 'lib/log_sinks/ruby_logger_adapter.rb', line 40 def initialize(logger, progname) @progname = progname @logger = logger @meta = { progname: @progname } end |
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
46 47 48 49 |
# File 'lib/log_sinks/ruby_logger_adapter.rb', line 46 def add(severity, = nil, progname = nil, &block) severity = ::LogSinks::Level[severity] unless severity.is_a? ::LogSinks::Level log_event(severity, , progname, &block) end |