class Slatan::Buttocks
Wrapper class of Logger
Public Class Methods
debug(msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 28 def debug(msg) @@log.debug(msg) if @@use_log stdoutput('debug', msg) end
error(msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 43 def error(msg) @@log.error(msg) if @@use_log stdoutput('error', msg) end
fatal(msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 48 def fatal(msg) @@log.fatal(msg) if @@use_log stdoutput('fatal', msg) end
info(msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 33 def info(msg) @@log.info(msg) if @@use_log stdoutput('info', msg) end
init()
click to toggle source
# File lib/slatan/buttocks.rb, line 19 def init() if @@use_log path = Spirit.log_file_path @@log = Logger.new(path) @@log.level = const_level(Spirit.log_level) end end
warn(msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 38 def warn(msg) @@log.warn(msg) if @@use_log stdoutput('warn', msg) end
Private Class Methods
const_level(level)
click to toggle source
# File lib/slatan/buttocks.rb, line 54 def const_level(level) case level when 'debug' Logger::DEBUG when 'info' Logger::INFO when 'warn' Logger::WARN when 'error' Logger::ERROR else Logger::FATAL end end
stdoutput(level, msg)
click to toggle source
# File lib/slatan/buttocks.rb, line 69 def stdoutput(level, msg) puts "\e[#{@@color[level.to_sym]}m[#{level}] #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}: #{msg}" print "\e[#{@@color[:reset]}m" end