json_tagged_logger 0.8.0 → 0.8.2
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 +4 -0
- data/lib/json_tagged_logger/formatter.rb +3 -2
- data/lib/json_tagged_logger/logger.rb +0 -1
- data/lib/json_tagged_logger/version.rb +1 -1
- data/lib/json_tagged_logger.rb +1 -0
- 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: 60b65905b594568132848dd19437991995a95f753c4c17c0f4cccbed0ea93a4d
|
4
|
+
data.tar.gz: c27b8077f80957690b5208d3a1a4119be8c05d026c2a0bf0a4e3d7b223d8ec7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d429b7283e5dd3e44ebc44d79611395c3bf1b47c2884709e81644a1e0e4a9813537f64f4649e4c55ea2c7184ad0b6797dc5b62f93654efe65577b46be6eb74
|
7
|
+
data.tar.gz: 0f0faa35d5544a9a9d73137a053a39453835c5ea3fbb7dde2b89b6666fe93393d3888f3dc8424ca6fcf781478d486116f29564d343a518b9fdbc8f6661259ccb
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# JsonTaggedLogger
|
2
2
|
|
3
3
|
[](https://github.com/santry/json_tagged_logger/actions/workflows/ci.yml)
|
4
|
+
[](https://badge.fury.io/rb/json_tagged_logger)
|
4
5
|
|
5
6
|
`JsonTaggedLogger` works in conjunction with [`ActiveSupport::TaggedLogging`](https://api.rubyonrails.org/classes/ActiveSupport/TaggedLogging.html) and (optionally) [Lograge](https://github.com/roidrage/lograge) to produce JSON-formatted log output. By itself, `ActiveSupport::TaggedLogging` supports simple tagging. With `JsonTaggedLogger`, you can compose key/value pairs, simple tags, and the log message itself into a single JSON document for easy consumption and parsing in log aggregators.
|
6
7
|
|
@@ -44,6 +45,7 @@ will get you something like
|
|
44
45
|
```json
|
45
46
|
{
|
46
47
|
"level": "INFO",
|
48
|
+
"time": "2025-02-04 18:56:44 +0300",
|
47
49
|
"request_id": "914f6104-538d-4ddc-beef-37bfe06ca1c7",
|
48
50
|
"host": "127.0.0.1",
|
49
51
|
"my_param": "param value",
|
@@ -69,6 +71,7 @@ Importantly, if the controller action (or any code it calls along the way) has a
|
|
69
71
|
```json
|
70
72
|
{
|
71
73
|
"level": "INFO",
|
74
|
+
"time": "2025-02-04 18:56:44 +0300",
|
72
75
|
"request_id": "914f6104-538d-4ddc-beef-37bfe06ca1c7",
|
73
76
|
"host": "127.0.0.1",
|
74
77
|
"my_param": "param value",
|
@@ -95,6 +98,7 @@ those will be added to the `tags` key in the JSON document
|
|
95
98
|
```json
|
96
99
|
{
|
97
100
|
"level": "INFO",
|
101
|
+
"time": "2025-02-04 18:56:44 +0300",
|
98
102
|
"request_id": "914f6104-538d-4ddc-beef-37bfe06ca1c7",
|
99
103
|
"host": "127.0.0.1",
|
100
104
|
"my_param": "param value",
|
@@ -1,5 +1,5 @@
|
|
1
|
+
require 'active_support'
|
1
2
|
require 'active_support/core_ext/hash/keys'
|
2
|
-
require 'active_support/tagged_logging'
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module JsonTaggedLogger
|
@@ -12,9 +12,10 @@ module JsonTaggedLogger
|
|
12
12
|
@pretty_print = pretty_print
|
13
13
|
end
|
14
14
|
|
15
|
-
def call(severity,
|
15
|
+
def call(severity, time, _progname, message)
|
16
16
|
log = {
|
17
17
|
level: severity,
|
18
|
+
time: time
|
18
19
|
}
|
19
20
|
|
20
21
|
json_tags, text_tags = extract_tags
|
data/lib/json_tagged_logger.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.2
|
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.5.
|
118
|
+
rubygems_version: 3.5.22
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: JSON Tagged Log Formatter
|