json_tagged_logger 0.6.0 → 0.7.0
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 +1 -1
- data/lib/json_tagged_logger/formatter.rb +4 -3
- data/lib/json_tagged_logger/logger.rb +2 -2
- data/lib/json_tagged_logger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43ee559e53a24cf5c12cd1163c1fd8713d8351cd3e6cc6b175dd92fd840a9de
|
4
|
+
data.tar.gz: a0a1683625c7fd6342974f4f00c53820c61d26a703110a61becafee2bf5f1b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6610c361726d1c670a35b6c92a6926995bddeb674fd4f1e19d7372fcb0b22d6c0de601b3681d9236c1764c6ae1ebebe56a6d0e144cc85442ea54712b0122d978
|
7
|
+
data.tar.gz: ef5fcd7fe3cbb1ca07ca8bb8e0e4b90b25092f1c6ecd261a1bd39670bd997a1847cbc8071513e57ae4b59cfb9b9069c1ab26863030677d840eb80b4517a54b0a
|
data/README.md
CHANGED
@@ -110,7 +110,7 @@ those will be added to the `tags` key in the JSON document
|
|
110
110
|
|
111
111
|
## Why?
|
112
112
|
|
113
|
-
On its own, `ActiveSupport::TaggedLogging` adds individual tags wrapped in
|
113
|
+
On its own, `ActiveSupport::TaggedLogging` adds individual tags wrapped in square brackets at the start of each line of log output. A configuration like
|
114
114
|
|
115
115
|
```ruby
|
116
116
|
Rails.application.configure do
|
@@ -6,7 +6,7 @@ module JsonTaggedLogger
|
|
6
6
|
attr_accessor :pretty_print
|
7
7
|
|
8
8
|
def initialize(pretty_print: false)
|
9
|
-
@
|
9
|
+
@pretty_print = pretty_print
|
10
10
|
end
|
11
11
|
|
12
12
|
def call(severity, _time, _progname, message)
|
@@ -37,8 +37,7 @@ module JsonTaggedLogger
|
|
37
37
|
|
38
38
|
log.merge!(parsed_message)
|
39
39
|
else
|
40
|
-
|
41
|
-
log.merge!(msg: parsed_message.strip)
|
40
|
+
log.merge!(msg: parsed_message.to_s.strip)
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
@@ -56,6 +55,8 @@ module JsonTaggedLogger
|
|
56
55
|
tag = JSON.parse(t)
|
57
56
|
rescue JSON::ParserError
|
58
57
|
tag = t
|
58
|
+
rescue TypeError
|
59
|
+
tag = t.to_s
|
59
60
|
ensure
|
60
61
|
if tag.is_a?(Hash)
|
61
62
|
json_tags << tag
|
@@ -3,8 +3,8 @@ require 'active_support/tagged_logging'
|
|
3
3
|
|
4
4
|
module JsonTaggedLogger
|
5
5
|
module Logger
|
6
|
-
def self.new(logger)
|
7
|
-
logger.formatter = Formatter.new
|
6
|
+
def self.new(logger, pretty_print: false)
|
7
|
+
logger.formatter = Formatter.new(pretty_print: pretty_print)
|
8
8
|
ActiveSupport::TaggedLogging.new(logger)
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_tagged_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Santry
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.5.6
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: JSON Tagged Log Formatter
|