Class: Rodbot::Log::LoggerIO

Inherits:
Object
  • Object
show all
Defined in:
lib/rodbot/log.rb

Overview

Simple wrapper to decorate a logger for use with $stdout and $stderr

Instance Method Summary collapse

Constructor Details

#initialize(logger, level) ⇒ LoggerIO

@ param logger [Logger] logger instance @ param level [Integer] any log level from Logger



50
51
52
# File 'lib/rodbot/log.rb', line 50

def initialize(logger, level)
  @logger, @level = logger, level
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject

Swallow any other method such as sync or flush



62
63
# File 'lib/rodbot/log.rb', line 62

def method_missing(*)
end

Instance Method Details

#write(message) ⇒ Object

Write to the log

Parameters:

  • message (String)

    log entry to add



57
58
59
# File 'lib/rodbot/log.rb', line 57

def write(message)
  @logger.log(@level, message.strip)
end