module GetaroundUtils::Mixins::Loggable

Public Instance Methods

base_append_infos_to_loggable(payload) click to toggle source
# File lib/getaround_utils/mixins/loggable.rb, line 13
def base_append_infos_to_loggable(payload)
  payload[:origin] = class_name
  return unless respond_to?(:append_infos_to_loggable)

  append_infos_to_loggable(payload)
end
class_name() click to toggle source
# File lib/getaround_utils/mixins/loggable.rb, line 9
def class_name
  @class_name ||= is_a?(Class) ? name : self.class.name
end
loggable_log(severity, message, payload = {}) click to toggle source
# File lib/getaround_utils/mixins/loggable.rb, line 28
def loggable_log(severity, message, payload = {})
  base_append_infos_to_loggable(payload)
  loggable_logger.send(severity.to_sym, msg: message, **payload)
end
loggable_logger() click to toggle source
# File lib/getaround_utils/mixins/loggable.rb, line 24
def loggable_logger
  (logger if respond_to?(:logger)) || (Rails.logger if defined?(Rails)) || loggable_logger_fallback
end
loggable_logger_fallback() click to toggle source
# File lib/getaround_utils/mixins/loggable.rb, line 20
def loggable_logger_fallback
  @loggable_logger_fallback ||= Logger.new($stdout)
end