Class: Semlogr::LogSeverity
- Inherits:
-
Object
- Object
- Semlogr::LogSeverity
- Includes:
- Comparable
- Defined in:
- lib/semlogr/log_severity.rb
Constant Summary collapse
- DEBUG =
LogSeverity.new(0, 'DEBUG')
- INFO =
LogSeverity.new(1, 'INFO')
- WARN =
LogSeverity.new(2, 'WARN')
- ERROR =
LogSeverity.new(3, 'ERROR')
- FATAL =
LogSeverity.new(4, 'FATAL')
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(value, display_string) ⇒ LogSeverity
constructor
A new instance of LogSeverity.
- #to_s ⇒ Object
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
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/semlogr/log_severity.rb', line 5 def value @value end |
Class Method Details
.create(severity) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/semlogr/log_severity.rb', line 12 def self.create(severity) case severity when :debug LogSeverity::DEBUG when :info LogSeverity::INFO when :warn LogSeverity::WARN when :error LogSeverity::ERROR when :fatal LogSeverity::FATAL else LogSeverity::DEBUG end end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 |
# File 'lib/semlogr/log_severity.rb', line 29 def <=>(other) @value <=> other.value end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/semlogr/log_severity.rb', line 33 def to_s @display_string end |