sapience 2.5.2 → 2.5.3
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/CHANGELOG.md +4 -0
- data/docker-compose.yml +1 -0
- data/lib/sapience/appender/stream.rb +1 -1
- data/lib/sapience/formatters/color.rb +15 -14
- data/lib/sapience/formatters/default.rb +9 -9
- data/lib/sapience/log.rb +9 -9
- data/lib/sapience/metrics/datadog.rb +1 -1
- data/lib/sapience/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b780de6c0e6cd44b9c195665fc83c5fd77ec28c
|
4
|
+
data.tar.gz: 9d7f2c1e50c99c110f569f1c8b5ba30a1957040c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 443375f18bd410d190be8c23c5d7a0b07815af6d3fad3bdb127b9310a53204637da67d1fafa139c85b6d4c353a0a5ef518d693b158353542961761471aed7de7
|
7
|
+
data.tar.gz: 29ff6baac968f8401b7046531e6eff3df847b8c2634d66b5df241897426159f2ace1185a695b2c59447f4957eb5ef869a552a070d9a9cbb6d4d5552ff7a41e75
|
data/CHANGELOG.md
CHANGED
data/docker-compose.yml
CHANGED
@@ -115,7 +115,7 @@ module Sapience
|
|
115
115
|
# Since only one appender thread will be writing to the file at a time
|
116
116
|
# it is not necessary to protect access to the file with a semaphore
|
117
117
|
# Allow this logger to filter out log levels lower than it's own
|
118
|
-
@log.write(
|
118
|
+
@log.write(formatter.call(log, self) + "\n")
|
119
119
|
true
|
120
120
|
end
|
121
121
|
|
@@ -28,38 +28,39 @@ module Sapience
|
|
28
28
|
colors = Sapience::AnsiColors
|
29
29
|
level_color = colors::LEVEL_MAP[log.level]
|
30
30
|
|
31
|
-
|
31
|
+
|
32
|
+
message = time_format.nil? ? "" : "#{format_time(log.time)} "
|
32
33
|
|
33
34
|
# Header with date, time, log level and process info
|
34
|
-
message
|
35
|
+
message += "#{level_color}#{log.level_to_s}#{colors::CLEAR} [#{log.process_info}]"
|
35
36
|
|
36
37
|
# Tags
|
37
|
-
message
|
38
|
+
message += " " + log.tags.collect { |tag| "[#{level_color}#{tag}#{colors::CLEAR}]" }.join(" ") if log.tags && !log.tags.empty? # rubocop:disable LineLength
|
38
39
|
|
39
40
|
# Duration
|
40
|
-
message
|
41
|
+
message += " (#{colors::BOLD}#{log.duration_human}#{colors::CLEAR})" if log.duration
|
41
42
|
|
42
43
|
# Class / app name
|
43
|
-
message
|
44
|
+
message += " #{level_color}#{log.name}#{colors::CLEAR}"
|
44
45
|
|
45
46
|
# Log message
|
46
|
-
message
|
47
|
+
message += " -- #{log.message}" if log.message
|
47
48
|
|
48
49
|
# Payload: Colorize the payload if the AwesomePrint gem is loaded
|
49
50
|
if log.payload?
|
50
51
|
payload = log.payload
|
51
|
-
message
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
message += " -- "
|
53
|
+
message += if defined?(AwesomePrint) && payload.respond_to?(:ai)
|
54
|
+
payload.ai(@ai_options) rescue payload.inspect # rubocop:disable RescueModifier
|
55
|
+
else
|
56
|
+
payload.inspect
|
57
|
+
end
|
57
58
|
end
|
58
59
|
|
59
60
|
# Exceptions
|
60
61
|
if log.exception
|
61
|
-
message
|
62
|
-
message
|
62
|
+
message += " -- Exception: #{colors::BOLD}#{log.exception.class}: #{log.exception.message}#{colors::CLEAR}\n"
|
63
|
+
message += log.backtrace_to_s
|
63
64
|
end
|
64
65
|
message
|
65
66
|
end
|
@@ -7,32 +7,32 @@ module Sapience
|
|
7
7
|
# 2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World
|
8
8
|
def call(log, _logger) # rubocop:disable AbcSize, PerceivedComplexity, CyclomaticComplexity
|
9
9
|
# Date & time
|
10
|
-
message = time_format.nil? ?
|
10
|
+
message = time_format.nil? ? "" : "#{format_time(log.time)} "
|
11
11
|
|
12
12
|
# Log level and process info
|
13
|
-
message
|
13
|
+
message += "#{log.level_to_s} [#{log.process_info}]"
|
14
14
|
|
15
15
|
# Tags
|
16
|
-
message
|
16
|
+
message += " " + log.tags.collect { |tag| "[#{tag}]" }.join(" ") if log.tags && !log.tags.empty?
|
17
17
|
|
18
18
|
# Duration
|
19
|
-
message
|
19
|
+
message += " (#{log.duration_human})" if log.duration
|
20
20
|
|
21
21
|
# Class / app name
|
22
|
-
message
|
22
|
+
message += " #{log.name}"
|
23
23
|
|
24
24
|
# Log message
|
25
|
-
message
|
25
|
+
message += " -- #{log.message}" if log.message
|
26
26
|
|
27
27
|
# Payload
|
28
28
|
if (payload = log.payload_to_s)
|
29
|
-
message
|
29
|
+
message += " -- " + payload
|
30
30
|
end
|
31
31
|
|
32
32
|
# Exceptions
|
33
33
|
if log.exception
|
34
|
-
message
|
35
|
-
message
|
34
|
+
message += " -- Exception: #{log.exception.class}: #{log.exception.message}\n"
|
35
|
+
message += log.backtrace_to_s
|
36
36
|
end
|
37
37
|
message
|
38
38
|
end
|
data/lib/sapience/log.rb
CHANGED
@@ -55,12 +55,12 @@ module Sapience
|
|
55
55
|
|
56
56
|
# Returns [String] the exception backtrace including all of the child / caused by exceptions
|
57
57
|
def backtrace_to_s
|
58
|
-
trace =
|
58
|
+
trace = ""
|
59
59
|
each_exception do |exception, i|
|
60
60
|
if i == 0
|
61
|
-
trace
|
61
|
+
trace += (exception.backtrace || []).join("\n")
|
62
62
|
else
|
63
|
-
trace
|
63
|
+
trace += "\nCause: #{exception.class.name}: #{exception.message}\n#{(exception.backtrace || []).join("\n")}"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
trace
|
@@ -81,12 +81,12 @@ module Sapience
|
|
81
81
|
minutes, ms = ms.divmod(MILLISECONDS_IN_MINUTE)
|
82
82
|
seconds, ms = ms.divmod(MILLISECONDS_IN_SECOND)
|
83
83
|
|
84
|
-
str =
|
85
|
-
str
|
86
|
-
str
|
87
|
-
str
|
88
|
-
str
|
89
|
-
str
|
84
|
+
str = ""
|
85
|
+
str += "#{days}d" if days > 0
|
86
|
+
str += " #{hours}h" if hours > 0
|
87
|
+
str += " #{minutes}m" if minutes > 0
|
88
|
+
str += " #{seconds}s" if seconds > 0
|
89
|
+
str += " #{ms}ms" if ms > 0
|
90
90
|
|
91
91
|
if days > 0 || hours > 0 || minutes > 0
|
92
92
|
str.strip
|
@@ -150,7 +150,7 @@ module Sapience
|
|
150
150
|
|
151
151
|
def namespace
|
152
152
|
ns = Sapience.namify(Sapience.app_name)
|
153
|
-
ns
|
153
|
+
ns += ".#{Sapience.namify(Sapience.environment)}" if Sapience.environment
|
154
154
|
ns
|
155
155
|
end
|
156
156
|
|
data/lib/sapience/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapience
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|