Class: Logging::RootLogger
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
-
#level ⇒ Object
Returns the value of attribute level.
Attributes inherited from Logger
#additive, #name, #parent, #trace
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
call-seq: log <=> other.
-
#initialize ⇒ RootLogger
constructor
call-seq: RootLogger.new.
Methods inherited from Logger
#<<, #_dump_configuration, #_meta_eval, #_setup, #add, #add_appenders, #appenders, #appenders=, #clear_appenders, define_log_methods, #inspect, new, #remove_appenders, root
Constructor Details
#initialize ⇒ RootLogger
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.const_defined? 'MAX_LEVEL_LENGTH' @name = 'root' @appenders = [] @additive = false @trace = false @level = 0 ::Logging::Logger.define_log_methods(self) end |
Instance Attribute Details
#level ⇒ Object
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 |