Class: SemanticLogger::Appender::HoneybadgerInsights
- Inherits:
-
Subscriber
- Object
- Base
- Subscriber
- SemanticLogger::Appender::HoneybadgerInsights
- Defined in:
- lib/semantic_logger/appender/honeybadger_insights.rb
Instance Attribute Summary
Attributes inherited from Subscriber
#application, #environment, #formatter, #host, #logger, #metrics
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(level: :info, **args, &block) ⇒ HoneybadgerInsights
constructor
Honeybadger Appender.
-
#log(log) ⇒ Object
Send log to honeybadger events API.
Methods inherited from Subscriber
#close, #console_output?, #flush, #level, #should_log?
Methods inherited from Base
#backtrace, #fast_tag, #level, #level=, #measure, #named_tags, #pop_tags, #push_tags, #should_log?, #silence, #tagged, #tags
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(level: level, **args, &block) 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) ::Honeybadger.event(event) true end |