Sha256: bc7a60223715bf725f438dbd319b472c7d36858c53ae5a89d496c3e39b2c5580

Contents?: true

Size: 1.52 KB

Versions: 53

Compression:

Stored size: 1.52 KB

Contents

module Logging

  # 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.
  #
  class RootLogger < Logger

    # undefine the methods that the root logger does not need
    %w(additive additive= parent parent=).each do |m|
      undef_method m.intern
    end

    attr_reader :level

    # call-seq:
    #    RootLogger.new
    #
    # Returns a new root logger instance. This method will be called only
    # once when the +Repository+ singleton instance is created.
    #
    def initialize( )
      ::Logging.init unless ::Logging.initialized?

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

    # call-seq:
    #    log <=> other
    #
    # Compares this logger by name to another logger. The normal return codes
    # for +String+ objects apply.
    #
    def <=>( other )
      case other
      when self; 0
      when ::Logging::Logger; -1
      else raise ArgumentError, 'expecting a Logger instance' end
    end

    # call-seq:
    #    level = :all
    #
    # Set the level for the root logger. The functionality of this method is
    # the same as +Logger#level=+, but setting the level to +nil+ for the
    # root logger is not allowed. The level is silently set to :all.
    #
    def level=( level )
      super(level || 0)
    end

  end  # class RootLogger
end  # module Logging

Version data entries

53 entries across 45 versions & 4 rubygems

Version Path
logging-2.4.0 lib/logging/root_logger.rb
logging-2.3.1 lib/logging/root_logger.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/root_logger.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/root_logger.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/root_logger.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/root_logger.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/root_logger.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/root_logger.rb
logging-2.3.0 lib/logging/root_logger.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/root_logger.rb