Class: SmartLoggerWrapper::Options::To

Inherits:
Base
  • Object
show all
Defined in:
lib/smart_logger_wrapper/options/to.rb

Instance Method Summary collapse

Instance Method Details

#apply!(messages, argument, severity, wrapper) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/smart_logger_wrapper/options/to.rb', line 7

def apply!(messages, argument, severity, wrapper)
  raise ApplicationError, 'No handler given' if argument == nil
  time = Time.now
  argument.puts messages.map { |message| wrapper.format_message(severity, time, nil, message) }.join("\n")
rescue NoMethodError => e
  raise ApplicationError, e.message
end