Class Log
In: lib/utility/log.rb
Parent: Object
Module
Log
Singleton
Log4r
dot/f_56.png

The Log class is a singleton that handles logging at the class level

Methods

loginit   new  

Included Modules

Singleton Log4r

Public Class methods

Load logger configuration

[Source]

# 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

Public Instance methods

Access a logger class

logname
The name of the logger
loglevel
the level of logging to do

[Source]

# File lib/utility/log.rb, line 41
  def loginit(logname, loglevel, logto)
    Logger.new(logname, Log4r.const_get(loglevel)).outputters = logto
    Logger[logname]
  end

[Validate]