Sha256: d3f1ca731a4ae2138a004d0475d2a8ddfe9cb44568a7b12ff80d5acb50b46029

Contents?: true

Size: 867 Bytes

Versions: 2

Compression:

Stored size: 867 Bytes

Contents

require 'slf4r/abstract_logger_facade'
module Slf4r
  class LoggerFacade4WrappedLogger

    @@logger = nil

    def self.new_logger_facade(name)
      raise "set logger first" unless @@logger
      @@logger
    end

    def self.logger=(logger)
      @@logger = logger
    end
  end

  class LoggerFacade < AbstractLoggerFacade

    def initialize(name)
      super
      @logger = LoggerFacade4WrappedLogger.new_logger_facade(name)
    end

    protected

    def _debug(msg)
      @logger.debug(msg)
    end

    def _info(msg)
      @logger.info(msg)
    end

    def _warn(msg)
      @logger.warn(msg)
    end

    def _error(msg)
      @logger.error(msg)
    end

    public 

    def debug?
      @logger.debug?
    end

    def info?
      @logger.info?
    end

    def warn?
      @logger.warn?
    end

    def error?
      @logger.error?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slf4r-0.3.0 lib/slf4r/wrapped_logger.rb
slf4r-0.2.0 lib/slf4r/wrapped_logger.rb