Module: Ougai::Logging::Severity

Includes:
Logger::Severity
Included in:
Ougai::Logging
Defined in:
lib/ougai/logging.rb

Constant Summary collapse

TRACE =
-1
SEV_LABEL =
%w(TRACE DEBUG INFO WARN ERROR FATAL UNKNOWN)

Instance Method Summary collapse

Instance Method Details

#from_label(severity) ⇒ Object



19
20
21
22
23
# File 'lib/ougai/logging.rb', line 19

def from_label(severity)
  SEV_LABEL.index(severity) - 1
rescue
  raise ArgumentError, "invalid log level: #{severity}"
end

#to_label(severity) ⇒ Object



15
16
17
# File 'lib/ougai/logging.rb', line 15

def to_label(severity)
  SEV_LABEL[severity + 1] || 'ANY'
end