Module: SubZero::Loggable
Constant Summary collapse
- COLORS =
[:red, :green, :yellow, :blue, :magenta, :cyan, :light_red, :light_green, :light_yellow, :light_blue, :light_magenta, :light_cyan]
- SEVERITIES =
[:info, :warn, :error, :debug]
- SEVERITY_COLORS =
{ info: :light_blue }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
31 32 33 |
# File 'lib/sub_zero/loggable.rb', line 31 def self.included(base) base.extend self end |
Instance Method Details
#error(exception, message) ⇒ Object
19 20 21 |
# File 'lib/sub_zero/loggable.rb', line 19 def error exception, super , error: exception end |
#log(message, context = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/sub_zero/loggable.rb', line 23 def log , context = {} sender_class = self.kind_of?(Class) ? self : self.class context.merge! sender_class: sender_class.to_s context[:severity] ||= :info puts (, context) end |