Class: Semlogr::LogSeverity

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/semlogr/log_severity.rb

Constant Summary collapse

DEBUG =
LogSeverity.new(::Logger::DEBUG, 'DEBUG')
INFO =
LogSeverity.new(::Logger::INFO, 'INFO')
WARN =
LogSeverity.new(::Logger::WARN, 'WARN')
ERROR =
LogSeverity.new(::Logger::ERROR, 'ERROR')
FATAL =
LogSeverity.new(::Logger::FATAL, 'FATAL')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, display_string) ⇒ LogSeverity

Returns a new instance of LogSeverity.



7
8
9
10
# File 'lib/semlogr/log_severity.rb', line 7

def initialize(value, display_string)
  @value = value
  @display_string = display_string
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/semlogr/log_severity.rb', line 5

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
# File 'lib/semlogr/log_severity.rb', line 12

def <=>(other)
  @value <=> other.value
end

#to_sObject



16
17
18
# File 'lib/semlogr/log_severity.rb', line 16

def to_s
  @display_string
end