Sha256: a2808c58bf91584e07ea8555ba3b843d69f2687f2f1a3530678afc890a4846f1

Contents?: true

Size: 878 Bytes

Versions: 8

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

class Logger
  # Logging severity.
  module Severity
    # Low-level information, mostly for developers.
    DEBUG = 0
    # Generic (useful) information about system operation.
    INFO = 1
    # A warning.
    WARN = 2
    # A handleable error condition.
    ERROR = 3
    # An unhandleable error that results in a program crash.
    FATAL = 4
    # An unknown message that should always be logged.
    UNKNOWN = 5

    LEVELS = {
      "debug" => DEBUG,
      "info" => INFO,
      "warn" => WARN,
      "error" => ERROR,
      "fatal" => FATAL,
      "unknown" => UNKNOWN,
    }
    private_constant :LEVELS

    def self.coerce(severity)
      if severity.is_a?(Integer)
        severity
      else
        key = severity.to_s.downcase
        LEVELS[key] || raise(ArgumentError, "invalid log level: #{severity}")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
es_cli-0.1.0 vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/severity.rb
logger-1.6.5 lib/logger/severity.rb
logger-1.6.4 lib/logger/severity.rb
logger-1.6.3 lib/logger/severity.rb
logger-1.6.2 lib/logger/severity.rb
logger-1.6.1 lib/logger/severity.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/logger-1.6.0/lib/logger/severity.rb
logger-1.6.0 lib/logger/severity.rb