Sha256: 5132ba8026819964a7f8a0e324cc1c250ca960eb628732ce1611438bc65c825c

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

require "logger"

module Dry
  module Logger
    LOG_METHODS = %i[debug error fatal info warn].freeze

    BACKEND_METHODS = %i[close].freeze

    DEBUG = ::Logger::DEBUG
    INFO = ::Logger::INFO
    WARN = ::Logger::WARN
    ERROR = ::Logger::ERROR
    FATAL = ::Logger::FATAL
    UNKNOWN = ::Logger::UNKNOWN

    LEVEL_RANGE = (DEBUG..UNKNOWN).freeze

    DEFAULT_LEVEL = INFO

    # @since 0.1.0
    # @api private
    LEVELS = Hash
      .new { |levels, key|
        LEVEL_RANGE.include?(key) ? key : levels.fetch(key.to_s.downcase, DEFAULT_LEVEL)
      }
      .update(
        "debug" => DEBUG,
        "info" => INFO,
        "warn" => WARN,
        "error" => ERROR,
        "fatal" => FATAL,
        "unknown" => UNKNOWN
      )
      .freeze

    DEFAULT_OPTS = {level: DEFAULT_LEVEL, formatter: nil, progname: nil}.freeze

    BACKEND_OPT_KEYS = DEFAULT_OPTS.keys.freeze
    FORMATTER_OPT_KEYS = %i[filter].freeze
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-logger-1.0.0.rc2 lib/dry/logger/constants.rb
dry-logger-1.0.0.rc1 lib/dry/logger/constants.rb