module GreenLog::Severity

Levels of severity.

Constants

DEBUG

Low-level information, mostly for developers.

ERROR

A handleable error condition.

FATAL

An unhandleable error that results in a program crash.

INFO

Generic (useful) information about system operation.

NAMES
WARN

A warning.

Public Class Methods

name(severity) click to toggle source
# File lib/green_log/severity.rb, line 23
def name(severity)
  NAMES[severity]
end
resolve(arg) click to toggle source
# File lib/green_log/severity.rb, line 27
def resolve(arg)
  value = _resolve(arg)
  return value if value && (DEBUG..FATAL).cover?(value)

  raise ArgumentError, "invalid severity: #{arg.inspect}"
end

Private Class Methods

_resolve(arg) click to toggle source
# File lib/green_log/severity.rb, line 36
def _resolve(arg)
  case arg
  when Integer
    arg
  when Symbol, String
    NAMES.index(arg.to_sym.upcase)
  end
end