class Gallus::Level
Internal: Log
level represented in a coherent way. You can easily compare log levels between each other. You’re also able to get log level by string/symbol name.
Attributes
id[R]
name[R]
Public Class Methods
[](name)
click to toggle source
Internal: Returns level defined under given name.
# File lib/gallus/level.rb, line 18 def self.[](name) const_get(name.to_s) end
all()
click to toggle source
Internal: All log levels.
# File lib/gallus/level.rb, line 8 def self.all @all ||= [] end
each(&block)
click to toggle source
Internal: Shorthand to all.each.
# File lib/gallus/level.rb, line 13 def self.each(&block) self.all.each(&block) end
new(name, id)
click to toggle source
Internal: Constructor. Initializes logger with given name and identifier, then registers it.
# File lib/gallus/level.rb, line 25 def initialize(name, id) @name, @id = name.to_s, id self.class.const_set(@name, self) self.class.all << self end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/gallus/level.rb, line 32 def <=>(other) self.id <=> other.id rescue => err return nil end
to_s()
click to toggle source
# File lib/gallus/level.rb, line 38 def to_s name end