Module: Log4r

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

Overview

:nodoc:

Defined Under Namespace

Modules: Log4rConfig, ROMPClient, ROMPServer Classes: BasicFormatter, 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/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