1
0
mirror of https://github.com/meineerde/rackstash.git synced 2026-02-01 01:37:12 +00:00

Move Rackstash.severity_label below the defined severities

This commit is contained in:
Holger Just 2017-08-04 16:05:12 +02:00
parent 3f70abde1a
commit 3dc3302794

View File

@ -45,6 +45,16 @@ module Rackstash
'ANY'.freeze
].freeze
def self.severity_label(severity)
if severity.is_a?(Integer)
return SEVERITY_LABELS.last if severity < 0
SEVERITY_LABELS[severity] || SEVERITY_LABELS.last
else
severity = SEVERITY_NAMES.fetch(severity.to_s.downcase, UNKNOWN)
SEVERITY_LABELS[severity]
end
end
PROGNAME = "rackstash/v#{Rackstash::VERSION}".freeze
# A class for the {UNDEFINED} object. Generally, there will only be exactly
@ -85,16 +95,6 @@ module Rackstash
FIELD_ERROR_MESSAGE = 'error_message'.freeze
FIELD_ERROR_TRACE = 'error_trace'.freeze
def self.severity_label(severity)
if severity.is_a?(Integer)
return SEVERITY_LABELS.last if severity < 0
SEVERITY_LABELS[severity] || SEVERITY_LABELS.last
else
severity = SEVERITY_NAMES.fetch(severity.to_s.downcase, UNKNOWN)
SEVERITY_LABELS[severity]
end
end
# Returns a {Flow} which is used by the normal logger {Flow}s to write details
# about any unexpected errors during interaction with their {Adapters}.
#