Sha256: 2adc7636db8ab4bf34ea17017fa52bc829af365883e006bbc42e3ceb6106ab20

Contents?: true

Size: 1.27 KB

Versions: 22

Compression:

Stored size: 1.27 KB

Contents

# :nodoc:
module SemanticLogger
  # :nodoc:
  module Concerns
    # :nodoc:
    module Compatibility
      #
      # For compatibility with Ruby Logger only.
      #
      def self.included(base)
        base.class_eval do
          # Map :unknown to :error
          alias_method :unknown, :error # :nodoc:
          alias_method :unknown?, :error? # :nodoc:

          alias_method :<<, :info # :nodoc:
          # Active Record's Session Store calls silence_logger
          alias_method :silence_logger, :silence # :nodoc:

          alias_method :progname, :name # :nodoc:
          alias_method :progname=, :name= # :nodoc:

          alias_method :sev_threshold, :level # :nodoc:
          alias_method :sev_threshold=, :level= # :nodoc:

          attr_accessor :formatter # :nodoc:
          attr_accessor :datetime_format # :nodoc:
        end
      end

      # :nodoc:
      def close
      end

      # :nodoc:
      def reopen(logdev = nil)
      end

      # :nodoc:
      def add(severity, message = nil, progname = nil, &block)
        index = Levels.index(severity)
        if level_index <= index
          level = Levels.level(index)
          log_internal(level, index, message, progname, &block)
          true
        else
          false
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
semantic_logger-4.16.1 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.16.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.15.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.14.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.13.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.12.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.11.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.10.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.9.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.8.2 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.8.1 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.8.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.7.4 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.7.3 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.7.2 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.7.1 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.7.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.6.1 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.6.0 lib/semantic_logger/concerns/compatibility.rb
semantic_logger-4.6.0.beta1 lib/semantic_logger/concerns/compatibility.rb