Module: Log4r

Defined in:
lib/log4r-color/NDC.rb,
lib/log4r-color.rb,
lib/log4r-color/GDC.rb,
lib/log4r-color/MDC.rb,
lib/log4r-color/base.rb,
lib/log4r-color/config.rb,
lib/log4r-color/logger.rb,
lib/log4r-color/logevent.rb,
lib/log4r-color/logserver.rb,
lib/log4r-color/repository.rb,
lib/log4r-color/configurator.rb,
lib/log4r-color/staticlogger.rb,
lib/log4r-color/lib/drbloader.rb,
lib/log4r-color/lib/xmlloader.rb,
lib/log4r-color/loggerfactory.rb,
lib/log4r-color/yamlconfigurator.rb,
lib/log4r-color/formatter/formatter.rb,
lib/log4r-color/outputter/outputter.rb,
lib/log4r-color/outputter/iooutputter.rb,
lib/log4r-color/outputter/udpoutputter.rb,
lib/log4r-color/outputter/fileoutputter.rb,
lib/log4r-color/outputter/emailoutputter.rb,
lib/log4r-color/outputter/remoteoutputter.rb,
lib/log4r-color/outputter/scribeoutputter.rb,
lib/log4r-color/outputter/staticoutputter.rb,
lib/log4r-color/outputter/syslogoutputter.rb,
lib/log4r-color/formatter/patternformatter.rb,
lib/log4r-color/outputter/outputterfactory.rb,
lib/log4r-color/formatter/log4jxmlformatter.rb,
lib/log4r-color/outputter/consoleoutputters.rb,
lib/log4r-color/outputter/datefileoutputter.rb,
lib/log4r-color/outputter/rollingfileoutputter.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Log4rConfig, ROMPClient, ROMPServer Classes: BasicFormatter, ColorOutputter, ConfigError, Configurator, DateFileOutputter, DefaultFormatter, EmailOutputter, FileOutputter, Formatter, GDC, IOOutputter, Log4jXmlFormatter, Log4rTools, LogEvent, LogServer, Logger, MDC, NDC, ObjectFormatter, Outputter, PatternFormatter, RemoteOutputter, RollingFileOutputter, RootLogger, ScribeOutputter, SimpleFormatter, StderrOutputter, StdoutOutputter, SyslogOutputter, UDPOutputter, YamlConfigurator

Constant Summary collapse

Log4rVersion =
[1, 1, 9].join '.'
GDCNAME =
"log4rGDC"
MDCNAME =
"log4rMDC"
MDCNAMEMAXDEPTH =
"log4rMDCMAXDEPTH"
NDCNAME =
"log4rNDC"
NDCNAMEMAXDEPTH =
"log4rNDCMAXDEPTH"
NDCDEFAULTMAXDEPTH =
256
ALL =
0
LNAMES =
['ALL']
SYSLOGNAMES =
Hash.new

Class Method Summary collapse

Class Method Details

.define_levels(*levels) ⇒ Object

Defines the log levels of the Log4r module at runtime. It is given either the default level spec (when root logger is created) or the user-specified level spec (when Logger.custom_levels is called).

The last constant defined by this method is OFF. Other level-sensitive parts of the code check to see if OFF is defined before deciding what to do. The typical action would be to force the creation of RootLogger so that the custom levels get loaded and business can proceed as usual.

For purposes of formatting, a constant named MaxLevelLength is defined in this method. It stores the max level name string size.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/log4r-color/base.rb', line 20

def Log4r.define_levels(*levels) #:nodoc:
  return if const_defined? :OFF
  for i in 0...levels.size
    name = levels[i].to_s
    module_eval "#{name} = #{i} + 1; LNAMES.push '#{name}'"
  end
  module_eval %{
    LNAMES.push 'OFF'
    LEVELS = LNAMES.size
    OFF = LEVELS - 1
    MaxLevelLength = Log4rTools.max_level_str_size
  }
end