semantic_logger 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/semantic_logger/ansi_colors.rb +11 -12
- data/lib/semantic_logger/appender.rb +4 -5
- data/lib/semantic_logger/appender/async.rb +24 -16
- data/lib/semantic_logger/appender/async_batch.rb +1 -4
- data/lib/semantic_logger/appender/bugsnag.rb +67 -63
- data/lib/semantic_logger/appender/elasticsearch.rb +154 -157
- data/lib/semantic_logger/appender/elasticsearch_http.rb +59 -55
- data/lib/semantic_logger/appender/file.rb +1 -3
- data/lib/semantic_logger/appender/graylog.rb +114 -110
- data/lib/semantic_logger/appender/honeybadger.rb +54 -51
- data/lib/semantic_logger/appender/http.rb +194 -190
- data/lib/semantic_logger/appender/kafka.rb +152 -149
- data/lib/semantic_logger/appender/mongodb.rb +3 -3
- data/lib/semantic_logger/appender/new_relic.rb +52 -49
- data/lib/semantic_logger/appender/sentry.rb +59 -54
- data/lib/semantic_logger/appender/splunk.rb +108 -103
- data/lib/semantic_logger/appender/splunk_http.rb +82 -79
- data/lib/semantic_logger/appender/syslog.rb +4 -5
- data/lib/semantic_logger/appender/tcp.rb +8 -29
- data/lib/semantic_logger/appender/udp.rb +2 -3
- data/lib/semantic_logger/appender/wrapper.rb +2 -2
- data/lib/semantic_logger/base.rb +18 -16
- data/lib/semantic_logger/concerns/compatibility.rb +0 -1
- data/lib/semantic_logger/core_ext/thread.rb +0 -1
- data/lib/semantic_logger/formatters.rb +3 -5
- data/lib/semantic_logger/formatters/base.rb +2 -3
- data/lib/semantic_logger/formatters/color.rb +29 -12
- data/lib/semantic_logger/formatters/default.rb +10 -10
- data/lib/semantic_logger/formatters/json.rb +0 -2
- data/lib/semantic_logger/formatters/one_line.rb +2 -2
- data/lib/semantic_logger/formatters/raw.rb +7 -10
- data/lib/semantic_logger/formatters/signalfx.rb +3 -5
- data/lib/semantic_logger/formatters/syslog.rb +2 -3
- data/lib/semantic_logger/formatters/syslog_cee.rb +2 -3
- data/lib/semantic_logger/jruby/garbage_collection_logger.rb +8 -5
- data/lib/semantic_logger/log.rb +17 -17
- data/lib/semantic_logger/loggable.rb +6 -9
- data/lib/semantic_logger/logger.rb +0 -1
- data/lib/semantic_logger/metric/new_relic.rb +58 -55
- data/lib/semantic_logger/metric/signalfx.rb +108 -106
- data/lib/semantic_logger/metric/statsd.rb +2 -3
- data/lib/semantic_logger/processor.rb +9 -9
- data/lib/semantic_logger/semantic_logger.rb +50 -30
- data/lib/semantic_logger/subscriber.rb +0 -1
- data/lib/semantic_logger/utils.rb +37 -37
- data/lib/semantic_logger/version.rb +2 -2
- data/test/appender/async_batch_test.rb +0 -1
- data/test/appender/async_test.rb +0 -1
- data/test/appender/bugsnag_test.rb +7 -8
- data/test/appender/elasticsearch_http_test.rb +5 -6
- data/test/appender/elasticsearch_test.rb +14 -10
- data/test/appender/file_test.rb +5 -6
- data/test/appender/graylog_test.rb +8 -8
- data/test/appender/honeybadger_test.rb +6 -7
- data/test/appender/http_test.rb +4 -5
- data/test/appender/kafka_test.rb +5 -6
- data/test/appender/mongodb_test.rb +11 -13
- data/test/appender/new_relic_test.rb +8 -9
- data/test/appender/newrelic_rpm.rb +1 -1
- data/test/appender/sentry_test.rb +7 -8
- data/test/appender/splunk_http_test.rb +4 -4
- data/test/appender/splunk_test.rb +1 -3
- data/test/appender/syslog_test.rb +3 -5
- data/test/appender/tcp_test.rb +4 -5
- data/test/appender/udp_test.rb +4 -5
- data/test/appender/wrapper_test.rb +2 -3
- data/test/concerns/compatibility_test.rb +0 -1
- data/test/debug_as_trace_logger_test.rb +0 -1
- data/test/formatters/color_test.rb +5 -6
- data/test/formatters/default_test.rb +16 -17
- data/test/formatters/one_line_test.rb +1 -2
- data/test/formatters/signalfx_test.rb +8 -11
- data/test/formatters_test.rb +3 -3
- data/test/in_memory_appender.rb +0 -1
- data/test/in_memory_appender_helper.rb +1 -1
- data/test/in_memory_batch_appender.rb +0 -1
- data/test/in_memory_metrics_appender.rb +0 -1
- data/test/loggable_test.rb +2 -3
- data/test/logger_test.rb +11 -14
- data/test/measure_test.rb +13 -15
- data/test/metric/new_relic_test.rb +2 -3
- data/test/metric/signalfx_test.rb +4 -5
- data/test/semantic_logger_test.rb +28 -3
- data/test/test_helper.rb +6 -7
- metadata +34 -34
@@ -10,65 +10,69 @@ require 'date'
|
|
10
10
|
# appender: :elasticsearch_http,
|
11
11
|
# url: 'http://localhost:9200'
|
12
12
|
# )
|
13
|
-
|
14
|
-
|
13
|
+
module SemanticLogger
|
14
|
+
module Appender
|
15
|
+
class ElasticsearchHttp < SemanticLogger::Appender::Http
|
16
|
+
attr_accessor :index, :type
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
18
|
+
# Create Elasticsearch appender over persistent HTTP(S)
|
19
|
+
#
|
20
|
+
# Parameters:
|
21
|
+
# index: [String]
|
22
|
+
# Prefix of the index to store the logs in Elasticsearch.
|
23
|
+
# The final index appends the date so that indexes are used per day.
|
24
|
+
# I.e. The final index will look like 'semantic_logger-YYYY.MM.DD'
|
25
|
+
# Default: 'semantic_logger'
|
26
|
+
#
|
27
|
+
# type: [String]
|
28
|
+
# Document type to associate with logs when they are written.
|
29
|
+
# Default: 'log'
|
30
|
+
#
|
31
|
+
# level: [:trace | :debug | :info | :warn | :error | :fatal]
|
32
|
+
# Override the log level for this appender.
|
33
|
+
# Default: SemanticLogger.default_level
|
34
|
+
#
|
35
|
+
# formatter: [Object|Proc|Symbol|Hash]
|
36
|
+
# An instance of a class that implements #call, or a Proc to be used to format
|
37
|
+
# the output from this appender
|
38
|
+
# Default: Use the built-in formatter (See: #call)
|
39
|
+
#
|
40
|
+
# filter: [Regexp|Proc]
|
41
|
+
# RegExp: Only include log messages where the class name matches the supplied.
|
42
|
+
# regular expression. All other messages will be ignored.
|
43
|
+
# Proc: Only include log messages where the supplied Proc returns true
|
44
|
+
# The Proc must return true or false.
|
45
|
+
#
|
46
|
+
# host: [String]
|
47
|
+
# Name of this host to appear in log messages.
|
48
|
+
# Default: SemanticLogger.host
|
49
|
+
#
|
50
|
+
# application: [String]
|
51
|
+
# Name of this application to appear in log messages.
|
52
|
+
# Default: SemanticLogger.application
|
53
|
+
def initialize(index: 'semantic_logger',
|
54
|
+
type: 'log',
|
55
|
+
url: 'http://localhost:9200',
|
56
|
+
**http_args,
|
57
|
+
&block)
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
level: level, formatter: formatter, filter: filter, application: application, host: host, &block)
|
59
|
+
@index = index
|
60
|
+
@type = type
|
61
|
+
super(url: url, **http_args, &block)
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
@request_path = "#{@path.end_with?('/') ? @path : "#{@path}/"}#{@index}-%Y.%m.%d"
|
64
|
+
@logging_path = "#{@request_path}/#{type}"
|
65
|
+
end
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
# Log to the index for today.
|
68
|
+
def log(log)
|
69
|
+
post(formatter.call(log, self), log.time.strftime(@logging_path))
|
70
|
+
end
|
68
71
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
# Deletes all log data captured for a day.
|
73
|
+
def delete_all(date = Date.today)
|
74
|
+
delete(date.strftime(@request_path))
|
75
|
+
end
|
76
|
+
end
|
72
77
|
end
|
73
|
-
|
74
78
|
end
|
@@ -5,7 +5,6 @@
|
|
5
5
|
module SemanticLogger
|
6
6
|
module Appender
|
7
7
|
class File < SemanticLogger::Subscriber
|
8
|
-
|
9
8
|
# Create a File Logger appender instance.
|
10
9
|
#
|
11
10
|
# Parameters
|
@@ -81,7 +80,7 @@ module SemanticLogger
|
|
81
80
|
def reopen
|
82
81
|
return unless @file_name
|
83
82
|
|
84
|
-
@log = open(@file_name,
|
83
|
+
@log = ::File.open(@file_name, ::File::WRONLY | ::File::APPEND | ::File::CREAT)
|
85
84
|
# Force all log entries to write immediately without buffering
|
86
85
|
# Allows multiple processes to write to the same log file simultaneously
|
87
86
|
@log.sync = true
|
@@ -105,7 +104,6 @@ module SemanticLogger
|
|
105
104
|
def flush
|
106
105
|
@log.flush if @log.respond_to?(:flush)
|
107
106
|
end
|
108
|
-
|
109
107
|
end
|
110
108
|
end
|
111
109
|
end
|
@@ -18,116 +18,120 @@ end
|
|
18
18
|
#
|
19
19
|
# In the Graylog Web UI search screen, it is recommended to include the following fields:
|
20
20
|
# `duration`, `level`, `message`, `metric`, `name`, `tags
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
module SemanticLogger
|
22
|
+
module Appender
|
23
|
+
class Graylog < SemanticLogger::Subscriber
|
24
|
+
# Map Semantic Logger levels to Graylog levels
|
25
|
+
class LevelMap
|
26
|
+
attr_accessor :trace, :debug, :info, :warn, :error, :fatal
|
27
|
+
|
28
|
+
def initialize(trace: GELF::DEBUG, debug: GELF::DEBUG, info: GELF::INFO, warn: GELF::WARN, error: GELF::ERROR, fatal: GELF::FATAL)
|
29
|
+
@trace = trace
|
30
|
+
@debug = debug
|
31
|
+
@info = info
|
32
|
+
@warn = warn
|
33
|
+
@error = error
|
34
|
+
@fatal = fatal
|
35
|
+
end
|
36
|
+
|
37
|
+
def [](level)
|
38
|
+
public_send(level)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
attr_accessor :url, :max_size, :gelf_options, :level_map
|
43
|
+
attr_reader :notifier, :server, :port, :protocol
|
44
|
+
|
45
|
+
# Create Graylog log appender.
|
46
|
+
#
|
47
|
+
# Options:
|
48
|
+
# url: [String]
|
49
|
+
# Valid URL to post to.
|
50
|
+
# Log to UDP Example:
|
51
|
+
# 'udp://localhost:12201'
|
52
|
+
# Log to TCP Example:
|
53
|
+
# 'tcp://localhost:12201'
|
54
|
+
# Default: 'udp://localhost:12201'
|
55
|
+
#
|
56
|
+
# max_size: [String]
|
57
|
+
# Max udp packet size. Ignored when protocol is :tcp
|
58
|
+
# Default: "WAN"
|
59
|
+
#
|
60
|
+
# gelf_options: [Hash]
|
61
|
+
# Custom gelf options. See Graylog documentation.
|
62
|
+
#
|
63
|
+
# level: [:trace | :debug | :info | :warn | :error | :fatal]
|
64
|
+
# Override the log level for this appender.
|
65
|
+
# Default: SemanticLogger.default_level
|
66
|
+
#
|
67
|
+
# formatter: [Object|Proc]
|
68
|
+
# An instance of a class that implements #call, or a Proc to be used to format
|
69
|
+
# the output from this appender
|
70
|
+
# Default: Use the built-in formatter (See: #call)
|
71
|
+
#
|
72
|
+
# filter: [Regexp|Proc]
|
73
|
+
# RegExp: Only include log messages where the class name matches the supplied.
|
74
|
+
# regular expression. All other messages will be ignored.
|
75
|
+
# Proc: Only include log messages where the supplied Proc returns true
|
76
|
+
# The Proc must return true or false.
|
77
|
+
#
|
78
|
+
# host: [String]
|
79
|
+
# Name of this host to appear in log messages.
|
80
|
+
# Default: SemanticLogger.host
|
81
|
+
#
|
82
|
+
# application: [String]
|
83
|
+
# Name of this application to appear in log messages.
|
84
|
+
# Default: SemanticLogger.application
|
85
|
+
def initialize(url: 'udp://localhost:12201', max_size: 'WAN', gelf_options: {}, level_map: LevelMap.new,
|
86
|
+
level: nil, formatter: nil, filter: nil, application: nil, host: nil, &block)
|
87
|
+
|
88
|
+
@url = url
|
89
|
+
@max_size = max_size
|
90
|
+
@gelf_options = gelf_options
|
91
|
+
@level_map = level_map.is_a?(LevelMap) ? level_map : LevelMap.new(level_map)
|
92
|
+
|
93
|
+
super(level: level, formatter: formatter, filter: filter, application: application, host: host, &block)
|
94
|
+
reopen
|
95
|
+
end
|
96
|
+
|
97
|
+
# Re-open after process fork
|
98
|
+
def reopen
|
99
|
+
uri = URI.parse(@url)
|
100
|
+
@server = uri.host
|
101
|
+
@port = uri.port
|
102
|
+
@protocol = uri.scheme.to_sym
|
103
|
+
|
104
|
+
raise(ArgumentError, "Invalid protocol value: #{@protocol}. Must be :udp or :tcp") unless %i[udp tcp].include?(@protocol)
|
105
|
+
|
106
|
+
gelf_options[:protocol] ||= (@protocol == :tcp ? GELF::Protocol::TCP : GELF::Protocol::UDP)
|
107
|
+
gelf_options[:facility] ||= application
|
108
|
+
|
109
|
+
@notifier = GELF::Notifier.new(server, port, max_size, gelf_options)
|
110
|
+
@notifier.collect_file_and_line = false
|
111
|
+
end
|
112
|
+
|
113
|
+
# Returns [Hash] of parameters to send
|
114
|
+
def call(log, logger)
|
115
|
+
h = default_formatter.call(log, logger)
|
116
|
+
|
117
|
+
h[:short_message] = h.delete(:message) || log.exception.message
|
118
|
+
h[:level] = logger.level_map[log.level]
|
119
|
+
h[:level_str] = log.level.to_s
|
120
|
+
h[:duration_str] = h.delete(:duration)
|
121
|
+
h
|
122
|
+
end
|
123
|
+
|
124
|
+
# Forward log messages
|
125
|
+
def log(log)
|
126
|
+
notifier.notify!(formatter.call(log, self))
|
127
|
+
true
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
def default_formatter
|
133
|
+
SemanticLogger::Formatters::Raw.new(time_format: :seconds, time_key: :timestamp)
|
134
|
+
end
|
33
135
|
end
|
34
|
-
|
35
|
-
def [](level)
|
36
|
-
public_send(level)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
attr_accessor :url, :max_size, :gelf_options, :level_map
|
41
|
-
attr_reader :notifier, :server, :port, :protocol
|
42
|
-
|
43
|
-
# Create Graylog log appender.
|
44
|
-
#
|
45
|
-
# Options:
|
46
|
-
# url: [String]
|
47
|
-
# Valid URL to post to.
|
48
|
-
# Log to UDP Example:
|
49
|
-
# 'udp://localhost:12201'
|
50
|
-
# Log to TCP Example:
|
51
|
-
# 'tcp://localhost:12201'
|
52
|
-
# Default: 'udp://localhost:12201'
|
53
|
-
#
|
54
|
-
# max_size: [String]
|
55
|
-
# Max udp packet size. Ignored when protocol is :tcp
|
56
|
-
# Default: "WAN"
|
57
|
-
#
|
58
|
-
# gelf_options: [Hash]
|
59
|
-
# Custom gelf options. See Graylog documentation.
|
60
|
-
#
|
61
|
-
# level: [:trace | :debug | :info | :warn | :error | :fatal]
|
62
|
-
# Override the log level for this appender.
|
63
|
-
# Default: SemanticLogger.default_level
|
64
|
-
#
|
65
|
-
# formatter: [Object|Proc]
|
66
|
-
# An instance of a class that implements #call, or a Proc to be used to format
|
67
|
-
# the output from this appender
|
68
|
-
# Default: Use the built-in formatter (See: #call)
|
69
|
-
#
|
70
|
-
# filter: [Regexp|Proc]
|
71
|
-
# RegExp: Only include log messages where the class name matches the supplied.
|
72
|
-
# regular expression. All other messages will be ignored.
|
73
|
-
# Proc: Only include log messages where the supplied Proc returns true
|
74
|
-
# The Proc must return true or false.
|
75
|
-
#
|
76
|
-
# host: [String]
|
77
|
-
# Name of this host to appear in log messages.
|
78
|
-
# Default: SemanticLogger.host
|
79
|
-
#
|
80
|
-
# application: [String]
|
81
|
-
# Name of this application to appear in log messages.
|
82
|
-
# Default: SemanticLogger.application
|
83
|
-
def initialize(url: 'udp://localhost:12201', max_size: 'WAN', gelf_options: {}, level_map: LevelMap.new,
|
84
|
-
level: nil, formatter: nil, filter: nil, application: nil, host: nil, &block)
|
85
|
-
|
86
|
-
@url = url
|
87
|
-
@max_size = max_size
|
88
|
-
@gelf_options = gelf_options
|
89
|
-
@level_map = level_map.is_a?(LevelMap) ? level_map : LevelMap.new(level_map)
|
90
|
-
|
91
|
-
super(level: level, formatter: formatter, filter: filter, application: application, host: host, &block)
|
92
|
-
reopen
|
93
|
-
end
|
94
|
-
|
95
|
-
# Re-open after process fork
|
96
|
-
def reopen
|
97
|
-
uri = URI.parse(@url)
|
98
|
-
@server = uri.host
|
99
|
-
@port = uri.port
|
100
|
-
@protocol = uri.scheme.to_sym
|
101
|
-
|
102
|
-
raise(ArgumentError, "Invalid protocol value: #{@protocol}. Must be :udp or :tcp") unless [:udp, :tcp].include?(@protocol)
|
103
|
-
|
104
|
-
gelf_options[:protocol] ||= (@protocol == :tcp ? GELF::Protocol::TCP : GELF::Protocol::UDP)
|
105
|
-
gelf_options[:facility] ||= application
|
106
|
-
|
107
|
-
@notifier = GELF::Notifier.new(server, port, max_size, gelf_options)
|
108
|
-
@notifier.collect_file_and_line = false
|
109
|
-
end
|
110
|
-
|
111
|
-
# Returns [Hash] of parameters to send
|
112
|
-
def call(log, logger)
|
113
|
-
h = default_formatter.call(log, logger)
|
114
|
-
|
115
|
-
h[:short_message] = h.delete(:message) || log.exception.message
|
116
|
-
h[:level] = logger.level_map[log.level]
|
117
|
-
h[:level_str] = log.level.to_s
|
118
|
-
h[:duration_str] = h.delete(:duration)
|
119
|
-
h
|
120
|
-
end
|
121
|
-
|
122
|
-
# Forward log messages
|
123
|
-
def log(log)
|
124
|
-
notifier.notify!(formatter.call(log, self))
|
125
|
-
true
|
126
|
-
end
|
127
|
-
|
128
|
-
private
|
129
|
-
|
130
|
-
def default_formatter
|
131
|
-
SemanticLogger::Formatters::Raw.new(time_format: :seconds, time_key: :timestamp)
|
132
136
|
end
|
133
137
|
end
|
@@ -9,59 +9,62 @@ end
|
|
9
9
|
# Example:
|
10
10
|
# SemanticLogger.add_appender(appender: :honeybadger)
|
11
11
|
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
12
|
+
module SemanticLogger
|
13
|
+
module Appender
|
14
|
+
class Honeybadger < SemanticLogger::Subscriber
|
15
|
+
# Honeybadger Appender
|
16
|
+
#
|
17
|
+
# Parameters
|
18
|
+
# level: [:trace | :debug | :info | :warn | :error | :fatal]
|
19
|
+
# Override the log level for this appender.
|
20
|
+
# Default: :error
|
21
|
+
#
|
22
|
+
# formatter: [Object|Proc|Symbol|Hash]
|
23
|
+
# An instance of a class that implements #call, or a Proc to be used to format
|
24
|
+
# the output from this appender
|
25
|
+
# Default: Use the built-in formatter (See: #call)
|
26
|
+
#
|
27
|
+
# filter: [Regexp|Proc]
|
28
|
+
# RegExp: Only include log messages where the class name matches the supplied.
|
29
|
+
# regular expression. All other messages will be ignored.
|
30
|
+
# Proc: Only include log messages where the supplied Proc returns true
|
31
|
+
# The Proc must return true or false.
|
32
|
+
#
|
33
|
+
# host: [String]
|
34
|
+
# Name of this host to appear in log messages.
|
35
|
+
# Default: SemanticLogger.host
|
36
|
+
#
|
37
|
+
# application: [String]
|
38
|
+
# Name of this application to appear in log messages.
|
39
|
+
# Default: SemanticLogger.application
|
40
|
+
def initialize(level: :error, formatter: nil, filter: nil, application: nil, host: nil, &block)
|
41
|
+
super(level: level, formatter: formatter, filter: filter, application: application, host: host, &block)
|
42
|
+
end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
44
|
+
# Send an error notification to honeybadger
|
45
|
+
def log(log)
|
46
|
+
context = formatter.call(log, self)
|
47
|
+
if log.exception
|
48
|
+
context.delete(:exception)
|
49
|
+
::Honeybadger.notify(log.exception, context)
|
50
|
+
else
|
51
|
+
message = {
|
52
|
+
error_class: context.delete(:name),
|
53
|
+
error_message: context.delete(:message),
|
54
|
+
context: context
|
55
|
+
}
|
56
|
+
message[:backtrace] = log.backtrace if log.backtrace
|
57
|
+
::Honeybadger.notify(message)
|
58
|
+
end
|
59
|
+
true
|
60
|
+
end
|
59
61
|
|
60
|
-
|
62
|
+
private
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
# Use Raw Formatter by default
|
65
|
+
def default_formatter
|
66
|
+
SemanticLogger::Formatters::Raw.new
|
67
|
+
end
|
68
|
+
end
|
65
69
|
end
|
66
|
-
|
67
70
|
end
|