Class: Logging::RootLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/logging/root_logger.rb

Overview

The root logger exists to ensure that all loggers have a parent and a defined logging level. If a logger is additive, eventually its log events will propagate up to the root logger.

Instance Attribute Summary collapse

Attributes inherited from Logger

#additive, #caller_tracing, #name, #parent

Instance Method Summary collapse

Methods inherited from Logger

#<<, [], #_dump_configuration, #_meta_eval, #_setup, #add, #add_appenders, #appenders, #appenders=, #clear_appenders, define_log_methods, #has_own_level?, instantiate, log_methods_for_level, mutex, new, #remove_appenders, root

Constructor Details

#initializeRootLogger

call-seq:

RootLogger.new

Returns a new root logger instance. This method will be called only once when the Repository singleton instance is created.



23
24
25
26
27
28
29
30
31
32
# File 'lib/logging/root_logger.rb', line 23

def initialize( )
  ::Logging.init unless ::Logging.initialized?

  @name = 'root'
  @appenders = []
  @additive = false
  @caller_tracing = false
  @level = 0
  ::Logging::Logger.define_log_methods(self)
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



15
16
17
# File 'lib/logging/root_logger.rb', line 15

def level
  @level
end

Instance Method Details

#<=>(other) ⇒ Object

call-seq:

log <=> other

Compares this logger by name to another logger. The normal return codes for String objects apply.



40
41
42
43
44
45
# File 'lib/logging/root_logger.rb', line 40

def <=>( other )
  case other
  when self; 0
  when ::Logging::Logger; -1
  else raise ArgumentError, 'expecting a Logger instance' end
end