Sha256: eccdc1e62fb6f48c12c72796ab695dd4943c9ba618060815c60fb18a54a75beb
Contents?: true
Size: 764 Bytes
Versions: 5
Compression:
Stored size: 764 Bytes
Contents
=begin rdoc A logging class to allow us to log to locations =end class Loggable def initialize Logging.init :debug, :info, :warn, :error, :fatal self.class.loggers << file_logger file_logger.level = :info end def file_logger @file_logger ||= Logging.logger( Base.pool_logger_location, logging_opts ) end def stdout_logger @stdout_logger ||= Logging.logger(STDOUT, logging_opts.merge({:pattern => "%m\n"})) end def logging_opts {:pattern => "[%d] %-l : %m\n", :date_pattern => "%Y-%m-%d %H:%M:%S.%s"} end %w(info warn debug notice).each do |meth| define_method(meth.to_sym) do |*args| self.class.loggers.each {|l| l.send meth.to_sym, args} end end def self.loggers @loggers ||= [] end end
Version data entries
5 entries across 5 versions & 1 rubygems