Class: Processor::Messenger

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/processor/messenger.rb

Instance Method Summary collapse

Constructor Details

#initialize(level = :info, file = STDOUT) ⇒ Messenger

Returns a new instance of Messenger.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/processor/messenger.rb', line 5

def initialize(level = :info, file = STDOUT)
  if level == :null
    file = "/dev/null"
    level = :fatal
  end

  log_level = Logger.const_get(level.upcase);

  logger = ::Logger.new(file).tap do |logger|
    logger.formatter = method(:format_message)
    logger.level = log_level
  end

  super logger
end

Instance Method Details

#message(*args) ⇒ Object



21
22
23
# File 'lib/processor/messenger.rb', line 21

def message(*args)
  self.info *args
end