Class: Sibit::Log

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

Overview

Log.

Instance Method Summary collapse

Constructor Details

#initialize(log = $stdout) ⇒ Log

Constructor.

You may provide the log you want to see the messages in. If you don’t provide anything, the console will be used. The object you provide has to respond to the method info or puts in order to receive logging messages.



37
38
39
# File 'lib/sibit/log.rb', line 37

def initialize(log = $stdout)
  @log = log
end

Instance Method Details

#info(msg) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/sibit/log.rb', line 41

def info(msg)
  if @log.respond_to?(:info)
    @log.info(msg)
  elsif @log.respond_to?(:puts)
    @log.puts(msg)
  end
end