Sha256: 5ee22a2f160ff8361a29b3913f71d1b3cf5cf5e0982e2ed752eb78a32dc428b7

Contents?: true

Size: 1.3 KB

Versions: 42

Compression:

Stored size: 1.3 KB

Contents

module Spider; module Loggers
    
    class ApacheCommonsLogger
        
        def initialize(klass='spider')
            @logger = org.apache.commons.logging.LogFactory.getLog(klass)
        end
        
        def do_log(level, message=nil, &proc)
            if block_given?
                return unless send("#{level}?")
        	    message = yield
    	    end
            @logger.send(level, message)
        end
        
        def fatal(message, &proc)
            do_log(:fatal, message, &proc)
        end
        
        def error(message, &proc)
            do_log(:error, message, &proc)
        end
        
        def warn(message, &proc)
            do_log(:warn, message, &proc)
        end
        
        def info(message, &proc)
            do_log(:info, message, &proc)
        end
        
        def debug(message, &proc)
            do_log(:info, message, &proc)
        end
        
        def fatal?
            @logger.isFatalEnabled
        end
        
        def error?
            @logger.isErrorEnabled
        end
        
        def warn?
            @logger.isWarnEnabled
        end
        
        def info?
            @logger.isInfoEnabled
        end
        
        def debug?
            @logger.isDebugEnabled
        end
        
        
        
    end
    
end; end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
spiderfw-1.0.1 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-1.0.0 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.39 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.38 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.37 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.35 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.34 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.33 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.32 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.31 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.30 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.29 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.28 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.27 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.26 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.26.pre1 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.25 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.24 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.23 lib/spiderfw/utils/loggers/apache_commons_logger.rb
spiderfw-0.6.22 lib/spiderfw/utils/loggers/apache_commons_logger.rb