The Log class is a singleton that handles logging at the class level
Load logger configuration
# File lib/utility/log.rb, line 28 def initialize Logger['global'].level = DEBUG fmt = PatternFormatter.new(:pattern => "%d [%5l] (%c) %M", :date_pattern => "%y-%m-%d %H:%M:%S") StderrOutputter.new('stderr', :level => INFO, :formatter => fmt) FileOutputter.new('server', :level => DEBUG, :formatter => fmt, :filename => options['logfile'] || 'logs/server.log' , :trunc => 'false') end
Access a logger class
logname
The name of the logger
loglevel
the level of logging to do
# File lib/utility/log.rb, line 41 def loginit(logname, loglevel, logto) Logger.new(logname, Log4r.const_get(loglevel)).outputters = logto Logger[logname] end