Class: SemanticLogger::Appender::HoneybadgerInsights

Inherits:
Subscriber
  • Object
show all
Defined in:
lib/semantic_logger/appender/honeybadger_insights.rb

Instance Attribute Summary

Attributes inherited from Subscriber

#application, #environment, #formatter, #host, #logger, #metrics

Instance Method Summary collapse

Methods inherited from Subscriber

#batch_by_default?, #close, #console_output?, #console_stream, #flush, #level, #should_log?

Constructor Details

#initialize(level: :info, **args, &block) ⇒ HoneybadgerInsights

Honeybadger Appender

Parameters level: [:trace | :debug | :info | :warn | :error | :fatal] Override the log level for this appender. Default: :error

formatter: [Object|Proc|Symbol|Hash]
An instance of a class that implements #call, or a Proc to be used to format
the output from this appender
Default: Use the built-in formatter (See: #call)

filter: [Regexp|Proc]
RegExp: Only include log messages where the class name matches the supplied.
regular expression. All other messages will be ignored.
Proc: Only include log messages where the supplied Proc returns true
      The Proc must return true or false.

host: [String]
Name of this host to appear in log messages.
Default: SemanticLogger.host

application: [String]
Name of this application to appear in log messages.
Default: SemanticLogger.application


40
41
42
# File 'lib/semantic_logger/appender/honeybadger_insights.rb', line 40

def initialize(level: :info, **args, &block)
  super
end

Instance Method Details

#log(log) ⇒ Object

Send log to honeybadger events API



45
46
47
48
49
50
51
# File 'lib/semantic_logger/appender/honeybadger_insights.rb', line 45

def log(log)
  event = formatter.call(log, self).merge(event_type: "log")

  ::Honeybadger.event(event)

  true
end