module Keystone module Base def log(log_type,message, is_base_info = true) if is_base_info puts "[#{Time.now.strftime("%Y/%m/%d %H:%M:%S")}][#{$$}][#{log_type.to_s}] #{message}" else puts "[#{log_type.to_s}] #{message}" end end def info(message) log(:INFO,message) end def error(message) if message.is_a? Exception log(:ERROR,"#{message.message}") message.backtrace.each_with_index {|line, i| log(:ERROR,"#{line})",false) } else log(:ERROR,message.to_s) end end def warn(message) log(:WARN,message) end def debug(message) if $DEBUG log(:DEBUG,message) end end end end