Sha256: a2da9d0c5acac2b4574df9c0339f82753947ae879888505eddc06f77c43e4ae7
Contents?: true
Size: 616 Bytes
Versions: 7
Compression:
Stored size: 616 Bytes
Contents
require 'tmpdir' require 'logger' require 'xi/error_log' module Xi module Logger LOG_FILE = File.join(Dir.tmpdir, 'xi.log') def logger @@logger ||= begin logger = ::Logger.new(LOG_FILE) logger.formatter = proc do |severity, datetime, progname, msg| "[#{datetime.strftime("%F %T %L")}] #{msg}\n" end logger end end def debug(*args) logger.debug(args.map(&:to_s).join(' '.freeze)) end def error(error) logger.error("#{error}:\n#{error.backtrace.join("\n".freeze)}") ErrorLog.instance << error.to_s end end end
Version data entries
7 entries across 7 versions & 1 rubygems