module DRbService::Logging

DRbService logging methods and data.

Constants

LEVEL

Mapping of symbols to logging levels

Public Class Methods

included( mod ) click to toggle source

Inclusion callback: Add logging methods and instance variables to the Module mod.

# File lib/drbservice/utils.rb, line 319
def self::included( mod )

        # Logging class instance variables
        default_logger = Logger.new( $stderr )
        default_logger.level = $DEBUG ? Logger::DEBUG : Logger::WARN
        formatter = DRbService::LogFormatter.new( default_logger )
        default_logger.formatter = formatter

        mod.instance_variable_set( :@default_logger, default_logger )
        mod.instance_variable_set( :@default_log_formatter, formatter ) 
        mod.instance_variable_set( :@logger, default_logger )

        # Accessors
        class << mod
                include DRbService::Logging::ClassMethods

                # The log formatter that will be used when the logging subsystem is reset
                attr_accessor :default_log_formatter

                # The logger that will be used when the logging subsystem is reset
                attr_accessor :default_logger

                # The logger that's currently in effect
                attr_accessor :logger
                alias_method :log, :logger
                alias_method :log=, :logger=
        end

end

Public Instance Methods

initialize_copy( original ) click to toggle source

Copy constructor – clear the original’s log proxy.

Calls superclass method
# File lib/drbservice/utils.rb, line 403
def initialize_copy( original )
        @log_proxy = @log_debug_proxy = nil
        super
end
log() click to toggle source

Return the proxied logger.

# File lib/drbservice/utils.rb, line 410
def log
        @log_proxy ||= ClassNameProxy.new( self.class )
end
log_debug() click to toggle source

Return a proxied “debug” logger that ignores other level specification.

# File lib/drbservice/utils.rb, line 416
def log_debug
        @log_debug_proxy ||= ClassNameProxy.new( self.class, true )
end