Sha256: c9833bcbbeff407c1cfd95f19011a18625730d89cabce398b332ca4f512f5b16

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 Bytes

Contents

require '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.1.1 lib/slf4r/wrapped_logger.rb
slf4r-0.1.0 lib/slf4r/wrapped_logger.rb