class Freighter::Logger

Attributes

logger[R]

Public Class Methods

new() click to toggle source
# File lib/freighter/logger.rb, line 8
def initialize
  @logger = ::Logger.new(STDOUT)
  logger.formatter = ->(severity, time, progname, msg) { "#{severity}: #{msg}\n" }
end

Public Instance Methods

config_error(str) click to toggle source
# File lib/freighter/logger.rb, line 18
def config_error(str)
  error "Config error: #{str} not defined"
end
error(str) click to toggle source
# File lib/freighter/logger.rb, line 22
def error(str)
  logger.error str
  logger.error "Freighter hit an iceburg. To the life boats. All is lost. A truely unfortunate day in nautical affairs :("
  exit -1
end
method_missing(meth, *args, &block) click to toggle source
# File lib/freighter/logger.rb, line 13
def method_missing(meth, *args, &block)
  logger.level = OPTIONS.verbose ? ::Logger::DEBUG : ::Logger::INFO
  logger.send(meth, *args)
end