Class: LogSinks::RubyLoggerAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/log_sinks/ruby_logger_adapter.rb

Overview

Adapter for [LogSinks::Logger] to match [::Logger] interface.

Instance Method Summary collapse

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, message = nil, progname = nil, &block)
  severity = ::LogSinks::Level[severity] unless severity.is_a? ::LogSinks::Level
  log_event(severity, message, progname, &block)
end