semantic_logger 4.7.2 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b10135713f7777b24e23191888a3341d20e39f4576c3f93fb92e008212c71f1
|
4
|
+
data.tar.gz: 13d48205904e7bc452621c8f65da454dc7f77c21592318324bbffef2a1bf5bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c721150d177559864111177271517e51f1c52dae5ee8783839ef32ac09f24cfedcd2757f0406fabc10d181d5214521bdfd625b1def340236f74ed51ecf6ecaf
|
7
|
+
data.tar.gz: adbea6f546bd0dfaa9ba59d45950fdb775f0ea308599a4a50d2aad4353ac7809f8930c4013fdc1d4f9d0ece963728347ba06b726c6e6078ceb68302dde1b721d
|
@@ -40,42 +40,55 @@ module SemanticLogger
|
|
40
40
|
|
41
41
|
# Returns [Hash] of parameters to send to Bugsnag.
|
42
42
|
def call(log, logger)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
hash = SemanticLogger::Formatters::Raw.new.call(log, logger)
|
44
|
+
hash.delete(:message) if hash[:exception] && (hash[:message] == hash[:exception][:message])
|
45
|
+
hash.delete(:time)
|
46
|
+
hash.delete(:level_index)
|
47
|
+
hash.delete(:exception)
|
48
|
+
hash[:file] = "#{hash[:file]}:#{hash.delete(:line)}" if hash.key?(:file)
|
49
|
+
hash
|
49
50
|
end
|
50
51
|
|
51
|
-
# Send an error notification to Bugsnag
|
52
52
|
def log(log)
|
53
53
|
# Ignore logs coming from Bugsnag itself
|
54
54
|
return false if log.name == "Bugsnag"
|
55
55
|
|
56
56
|
# Send error messages as Runtime exceptions
|
57
|
-
exception =
|
58
|
-
|
59
|
-
|
60
|
-
log.exception.set_backtrace(log.backtrace) if !log.exception.backtrace && log.backtrace
|
61
|
-
log.exception
|
62
|
-
else
|
63
|
-
error = RuntimeError.new(log.message)
|
64
|
-
error.set_backtrace(log.backtrace) if log.backtrace
|
65
|
-
error
|
66
|
-
end
|
67
|
-
|
68
|
-
# For more documentation on the Bugsnag.notify method see:
|
69
|
-
# https://bugsnag.com/docs/notifiers/ruby#sending-handled-exceptions
|
70
|
-
::Bugsnag.notify(exception, formatter.call(log, self))
|
57
|
+
exception = extract_exception(log)
|
58
|
+
hash = formatter.call(log, self)
|
59
|
+
bugsnag_notify(exception, hash, log_level(log.level))
|
71
60
|
true
|
72
61
|
end
|
73
62
|
|
74
63
|
private
|
75
64
|
|
65
|
+
def bugsnag_notify(exception, hash, level)
|
66
|
+
if ::Bugsnag::VERSION.to_i >= 6
|
67
|
+
::Bugsnag.notify(exception) do |report|
|
68
|
+
report.severity = level
|
69
|
+
hash.each_pair { |key, value| report.add_tab(key, value) }
|
70
|
+
end
|
71
|
+
else
|
72
|
+
hash[:severity] = level
|
73
|
+
::Bugsnag.notify(exception, hash)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def extract_exception(log)
|
78
|
+
if log.exception
|
79
|
+
# Manually constructed Exception, without a backtrace.
|
80
|
+
log.exception.set_backtrace(log.backtrace) if !log.exception.backtrace && log.backtrace
|
81
|
+
return log.exception
|
82
|
+
end
|
83
|
+
|
84
|
+
error = RuntimeError.new(log.message)
|
85
|
+
error.set_backtrace(log.backtrace) if log.backtrace
|
86
|
+
error
|
87
|
+
end
|
88
|
+
|
76
89
|
# Bugsnag supports: error, warning or info
|
77
|
-
def log_level(
|
78
|
-
case
|
90
|
+
def log_level(level)
|
91
|
+
case level
|
79
92
|
when :error, :fatal
|
80
93
|
"error"
|
81
94
|
when :warn
|
@@ -90,6 +90,7 @@ module SemanticLogger
|
|
90
90
|
# https://docs.splunk.com/Documentation/Splunk/latest/Data/FormateventsforHTTPEventCollector
|
91
91
|
def call(log, logger)
|
92
92
|
h = SemanticLogger::Formatters::Raw.new(time_format: :seconds).call(log, logger)
|
93
|
+
h.delete(:host)
|
93
94
|
message = {
|
94
95
|
source: logger.application,
|
95
96
|
host: logger.host,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.7.
|
4
|
+
version: 4.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- reidmo@gmail.com
|
30
30
|
executables: []
|
@@ -93,7 +93,7 @@ homepage: https://github.com/rocketjob/semantic_logger
|
|
93
93
|
licenses:
|
94
94
|
- Apache-2.0
|
95
95
|
metadata: {}
|
96
|
-
post_install_message:
|
96
|
+
post_install_message:
|
97
97
|
rdoc_options: []
|
98
98
|
require_paths:
|
99
99
|
- lib
|
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
111
|
+
rubygems_version: 3.0.8
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Feature rich logging framework, and replacement for existing Ruby & Rails
|
115
115
|
loggers.
|