Module: Axn::Core::AutomaticLogging::ClassMethods

Defined in:
lib/axn/core/automatic_logging.rb

Instance Method Summary collapse

Instance Method Details

#_auto_log_before_levelObject

The "About to execute" / start line rides at the success level (and is suppressed when success logging is off), so the before/after bookend is a property of narrating successful calls rather than a separate knob.



79
80
81
# File 'lib/axn/core/automatic_logging.rb', line 79

def _auto_log_before_level
  _auto_log_levels[:success]
end

#_auto_log_level_for(outcome) ⇒ Object

Level for a given outcome, or nil if that outcome should not be logged.



72
73
74
# File 'lib/axn/core/automatic_logging.rb', line 72

def _auto_log_level_for(outcome)
  _auto_log_levels[outcome.to_sym]
end

#auto_log(*args, **overrides) ⇒ Object

Declarative control over automatic logging. Examples:

auto_log :warn                     # all outcomes at :warn (before + after)
auto_log false                     # fully silent
auto_log :warn, success: false     # errors only, no before line
auto_log exception: :error         # only log raised exceptions


67
68
69
# File 'lib/axn/core/automatic_logging.rb', line 67

def auto_log(*args, **overrides)
  self._auto_log_levels = AutomaticLogging.resolve_levels(args, overrides)
end