class Log

Public Class Methods

new(opts={}) click to toggle source
# File lib/panopticon/log.rb, line 3
def initialize opts={}
  @debug_mode = opts[:debug_mode] || false
  @output = opts[:output] || STDOUT

  case @output
  when "STDOUT"
    @output = STDOUT
  when "STDERR"
    @output = STDERR
  end
  @logger = Logger.new(@output)

  @logger.datetime_format = "%Y%m%d%H%m%S"
  @logger.formatter = proc { |severity, datetime, progname, msg|
    "[#{datetime}] #{progname}\t#{severity}: #{msg}\n"
  }
end

Public Instance Methods

debug(str) click to toggle source
# File lib/panopticon/log.rb, line 33
def debug str
  @logger.debug(str)
end
err(str) click to toggle source
# File lib/panopticon/log.rb, line 25
def err str
  @logger.error(str)
end
info(str) click to toggle source
# File lib/panopticon/log.rb, line 29
def info str
  @logger.info(str)
end
warn(str) click to toggle source
# File lib/panopticon/log.rb, line 21
def warn str
  @logger.warn(str)
end