Sha256: bea83a7fe5bd9a788a50bad7445f902a89b8b713891032857512c780e6f0ae6f
Contents?: true
Size: 584 Bytes
Versions: 13
Compression:
Stored size: 584 Bytes
Contents
require 'logger' module Guignol::Logger def logger @logger ||= ::Logger.new(logger_file).tap do |logger| logger.progname = 'guignol' logger.formatter = Formatter.new end end private class Formatter < ::Logger::Formatter Format = "[%s] %s: %s\n" def call(severity, time, progname, msg) Format % [time.strftime('%F %T'), severity, msg2str(msg)] end end def logger_file return File.open(ENV['GUIGNOL_LOG'] ,'a') if ENV['GUIGNOL_LOG'] $stdout.tty? ? $stdout : File.open('/dev/null','w') end Guignol.extend(self) end
Version data entries
13 entries across 13 versions & 1 rubygems