module ClassLogging::ClassMethods

Public Instance Methods

init_logger() click to toggle source
# File lib/unicorn-cuba-base/root_logger.rb, line 198
def init_logger
        @@logger = {} unless defined? @@logger
end
log() click to toggle source
# File lib/unicorn-cuba-base/root_logger.rb, line 206
def log
        unless @@logger.include? self
                root_logger = if an = ancestors.find{|an| an != self and an.respond_to? :log and an.log.respond_to? :root_logger}
                        an.log.root_logger
                else
                        RootLogger.new.tap do |logger|
                                logger.warn 'no root logger found; using default logger'
                        end
                end

                @@logger[self] = RootLogger::ClassLogger.new(root_logger, self)
        end
        @@logger[self]
end
logger=(logger) click to toggle source
# File lib/unicorn-cuba-base/root_logger.rb, line 202
def logger=(logger)
        @@logger[self] = logger
end
logger_for(class_obj) click to toggle source
# File lib/unicorn-cuba-base/root_logger.rb, line 221
def logger_for(class_obj)
        RootLogger::ClassLogger.new(log.root_logger, class_obj)
end