Sha256: f43e3dc2a66d963ef8d34d5e6db4ee190029c8e2399caf63bff29c72b842e752

Contents?: true

Size: 1.39 KB

Versions: 139

Compression:

Stored size: 1.39 KB

Contents

# :nodoc:
module Log4r
  class Logger
    # Returns the root logger. Identical to Logger.global
    def self.root; return RootLogger.instance end
    # Returns the root logger. Identical to Logger.root
    def self.global; return root end
    
    # Get a logger with a fullname from the repository or nil if logger
    # wasn't found.

    def self.[](_fullname)
      # forces creation of RootLogger if it doesn't exist yet.
      return RootLogger.instance if _fullname=='root' or _fullname=='global'
      Repository[_fullname]
    end

    # Like Logger[] except that it raises NameError if Logger wasn't found.

    def self.get(_fullname)
      logger = self[_fullname]
      if logger.nil?
        raise NameError, "Logger '#{_fullname}' not found.", caller
      end
      logger
    end

    # Yields fullname and logger for every logger in the system.
    def self.each
      for fullname, logger in Repository.instance.loggers
        yield fullname, logger
      end
    end

    def self.each_logger
      Repository.instance.loggers.each_value {|logger| yield logger}
    end

    # Internal logging for Log4r components. Accepts only blocks.
    # To see such log events, create a logger named 'log4r' and give 
    # it an outputter.

    def self.log_internal(level=1)
      internal = Logger['log4r']
      return if internal.nil?
      internal.send(LNAMES[level].downcase, yield)
    end
  end
end

Version data entries

139 entries across 101 versions & 18 rubygems

Version Path
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
depengine-0.0.18 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.18 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.17 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.17 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.16 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.16 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.15 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.15 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.14 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.14 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.13 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.13 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
vagrant-shell-0.2.6 vendor/bundle/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
vagrant-shell-0.2.5 vendor/bundle/gems/log4r-1.1.10/lib/log4r/staticlogger.rb
depengine-0.0.12 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb
depengine-0.0.12 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/staticlogger.rb