Module: Honeybadger::Breadcrumbs::LogWrapper Private

Defined in:
lib/honeybadger/breadcrumbs/logging.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#add(severity, message = nil, progname = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/honeybadger/breadcrumbs/logging.rb', line 6

def add(severity, message = nil, progname = nil)
  org_severity, org_message, org_progname = severity, message, progname
  if defined?(Dry::Logger::Entry) && progname.is_a?(Dry::Logger::Entry) # Hanami uses dry-logger
    message, progname = progname.message || progname.exception, progname.progname
  else
    message, progname = [progname, nil] if message.nil?
  end
  message = message && message.to_s.strip
  unless should_ignore_log?(message, progname)
    Honeybadger.add_breadcrumb(message, category: :log, metadata: {
      severity: format_severity(severity),
      progname: progname
    })
  end

  super(org_severity, org_message, org_progname)
end