Sha256: 7552cbb8e2ac877b9a7b3bb88e483193f4459cabb2f5e57b7e6f1299a7845969

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

require "logger"

module NmiDirectPost
  class << self
    def logger
      @logger ||= defined?(::Rails.logger) ? Rails.logger : ::Logger.new(STDOUT)
    end
    def logger=(_)
      raise ArgumentError, "NmiDirectPost logger must respond to :info and :debug" unless logger_responds(_)
      @logger = _
    end
    private
      def logger_responds(logger)
        logger.respond_to?(:info) && logger.respond_to?(:debug)
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nmi_direct_post-0.3.2 lib/nmi_direct_post/logger.rb
nmi_direct_post-0.3.0 lib/nmi_direct_post/logger.rb
nmi_direct_post-0.2.0 lib/nmi_direct_post/logger.rb