log_sanity 1.0.0 → 1.1.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/Gemfile.lock +61 -64
- data/LICENSE +1 -1
- data/lib/log_sanity/formatter.rb +6 -6
- data/lib/log_sanity/railtie.rb +5 -1
- data/lib/log_sanity/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: ab2d94e3371c9459eaaac83dfe5476a33ff24fabdec99ca07f8821b1cbd14a36
|
4
|
+
data.tar.gz: 75a998827a8f1aeb321b51d90b2f7f754636400a73276de37c120089bd035ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac3c9206bbe0eb3c4061bf0fa423209192bbfa6baa8fd09dc0e47d9e01e8ad26a716ec6cf3db293cb9059624c8ffcc536dc2788c8b87fd5b86face2b49c8065a
|
7
|
+
data.tar.gz: 4b7ef5549ff3183a68e399c94afbda0a0d3e6a4e2e73988d446e0de5494c39374bab4ba7a0d6a4c54745b9bbce7e13624ededf25373a3ae7e847645234c8887f
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
log_sanity (1.
|
4
|
+
log_sanity (1.1.0)
|
5
5
|
rails (>= 5.2, < 6.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (6.
|
11
|
-
actionpack (= 6.
|
12
|
-
activesupport (= 6.1.0)
|
10
|
+
actioncable (6.0.3.4)
|
11
|
+
actionpack (= 6.0.3.4)
|
13
12
|
nio4r (~> 2.0)
|
14
13
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.
|
16
|
-
actionpack (= 6.
|
17
|
-
activejob (= 6.
|
18
|
-
activerecord (= 6.
|
19
|
-
activestorage (= 6.
|
20
|
-
activesupport (= 6.
|
14
|
+
actionmailbox (6.0.3.4)
|
15
|
+
actionpack (= 6.0.3.4)
|
16
|
+
activejob (= 6.0.3.4)
|
17
|
+
activerecord (= 6.0.3.4)
|
18
|
+
activestorage (= 6.0.3.4)
|
19
|
+
activesupport (= 6.0.3.4)
|
21
20
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.
|
23
|
-
actionpack (= 6.
|
24
|
-
actionview (= 6.
|
25
|
-
activejob (= 6.
|
26
|
-
activesupport (= 6.1.0)
|
21
|
+
actionmailer (6.0.3.4)
|
22
|
+
actionpack (= 6.0.3.4)
|
23
|
+
actionview (= 6.0.3.4)
|
24
|
+
activejob (= 6.0.3.4)
|
27
25
|
mail (~> 2.5, >= 2.5.4)
|
28
26
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.
|
30
|
-
actionview (= 6.
|
31
|
-
activesupport (= 6.
|
32
|
-
rack (~> 2.0, >= 2.0.
|
27
|
+
actionpack (6.0.3.4)
|
28
|
+
actionview (= 6.0.3.4)
|
29
|
+
activesupport (= 6.0.3.4)
|
30
|
+
rack (~> 2.0, >= 2.0.8)
|
33
31
|
rack-test (>= 0.6.3)
|
34
32
|
rails-dom-testing (~> 2.0)
|
35
33
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.
|
37
|
-
actionpack (= 6.
|
38
|
-
activerecord (= 6.
|
39
|
-
activestorage (= 6.
|
40
|
-
activesupport (= 6.
|
34
|
+
actiontext (6.0.3.4)
|
35
|
+
actionpack (= 6.0.3.4)
|
36
|
+
activerecord (= 6.0.3.4)
|
37
|
+
activestorage (= 6.0.3.4)
|
38
|
+
activesupport (= 6.0.3.4)
|
41
39
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.
|
43
|
-
activesupport (= 6.
|
40
|
+
actionview (6.0.3.4)
|
41
|
+
activesupport (= 6.0.3.4)
|
44
42
|
builder (~> 3.1)
|
45
43
|
erubi (~> 1.4)
|
46
44
|
rails-dom-testing (~> 2.0)
|
47
45
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.
|
49
|
-
activesupport (= 6.
|
46
|
+
activejob (6.0.3.4)
|
47
|
+
activesupport (= 6.0.3.4)
|
50
48
|
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.
|
52
|
-
activesupport (= 6.
|
53
|
-
activerecord (6.
|
54
|
-
activemodel (= 6.
|
55
|
-
activesupport (= 6.
|
56
|
-
activestorage (6.
|
57
|
-
actionpack (= 6.
|
58
|
-
activejob (= 6.
|
59
|
-
activerecord (= 6.
|
60
|
-
activesupport (= 6.1.0)
|
49
|
+
activemodel (6.0.3.4)
|
50
|
+
activesupport (= 6.0.3.4)
|
51
|
+
activerecord (6.0.3.4)
|
52
|
+
activemodel (= 6.0.3.4)
|
53
|
+
activesupport (= 6.0.3.4)
|
54
|
+
activestorage (6.0.3.4)
|
55
|
+
actionpack (= 6.0.3.4)
|
56
|
+
activejob (= 6.0.3.4)
|
57
|
+
activerecord (= 6.0.3.4)
|
61
58
|
marcel (~> 0.3.1)
|
62
|
-
|
63
|
-
activesupport (6.1.0)
|
59
|
+
activesupport (6.0.3.4)
|
64
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
-
i18n (>=
|
66
|
-
minitest (
|
67
|
-
tzinfo (~>
|
68
|
-
zeitwerk (~> 2.
|
61
|
+
i18n (>= 0.7, < 2)
|
62
|
+
minitest (~> 5.1)
|
63
|
+
tzinfo (~> 1.1)
|
64
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
69
65
|
builder (3.2.4)
|
70
66
|
concurrent-ruby (1.1.7)
|
71
67
|
crass (1.0.6)
|
@@ -92,32 +88,32 @@ GEM
|
|
92
88
|
rack (2.2.3)
|
93
89
|
rack-test (1.1.0)
|
94
90
|
rack (>= 1.0, < 3)
|
95
|
-
rails (6.
|
96
|
-
actioncable (= 6.
|
97
|
-
actionmailbox (= 6.
|
98
|
-
actionmailer (= 6.
|
99
|
-
actionpack (= 6.
|
100
|
-
actiontext (= 6.
|
101
|
-
actionview (= 6.
|
102
|
-
activejob (= 6.
|
103
|
-
activemodel (= 6.
|
104
|
-
activerecord (= 6.
|
105
|
-
activestorage (= 6.
|
106
|
-
activesupport (= 6.
|
107
|
-
bundler (>= 1.
|
108
|
-
railties (= 6.
|
91
|
+
rails (6.0.3.4)
|
92
|
+
actioncable (= 6.0.3.4)
|
93
|
+
actionmailbox (= 6.0.3.4)
|
94
|
+
actionmailer (= 6.0.3.4)
|
95
|
+
actionpack (= 6.0.3.4)
|
96
|
+
actiontext (= 6.0.3.4)
|
97
|
+
actionview (= 6.0.3.4)
|
98
|
+
activejob (= 6.0.3.4)
|
99
|
+
activemodel (= 6.0.3.4)
|
100
|
+
activerecord (= 6.0.3.4)
|
101
|
+
activestorage (= 6.0.3.4)
|
102
|
+
activesupport (= 6.0.3.4)
|
103
|
+
bundler (>= 1.3.0)
|
104
|
+
railties (= 6.0.3.4)
|
109
105
|
sprockets-rails (>= 2.0.0)
|
110
106
|
rails-dom-testing (2.0.3)
|
111
107
|
activesupport (>= 4.2.0)
|
112
108
|
nokogiri (>= 1.6)
|
113
109
|
rails-html-sanitizer (1.3.0)
|
114
110
|
loofah (~> 2.3)
|
115
|
-
railties (6.
|
116
|
-
actionpack (= 6.
|
117
|
-
activesupport (= 6.
|
111
|
+
railties (6.0.3.4)
|
112
|
+
actionpack (= 6.0.3.4)
|
113
|
+
activesupport (= 6.0.3.4)
|
118
114
|
method_source
|
119
115
|
rake (>= 0.8.7)
|
120
|
-
thor (
|
116
|
+
thor (>= 0.20.3, < 2.0)
|
121
117
|
rake (13.0.3)
|
122
118
|
sprockets (4.0.2)
|
123
119
|
concurrent-ruby (~> 1.0)
|
@@ -127,8 +123,9 @@ GEM
|
|
127
123
|
activesupport (>= 4.0)
|
128
124
|
sprockets (>= 3.0.0)
|
129
125
|
thor (1.0.1)
|
130
|
-
|
131
|
-
|
126
|
+
thread_safe (0.3.6)
|
127
|
+
tzinfo (1.2.8)
|
128
|
+
thread_safe (~> 0.1)
|
132
129
|
websocket-driver (0.7.3)
|
133
130
|
websocket-extensions (>= 0.1.0)
|
134
131
|
websocket-extensions (0.1.5)
|
data/LICENSE
CHANGED
data/lib/log_sanity/formatter.rb
CHANGED
@@ -9,12 +9,16 @@
|
|
9
9
|
|
10
10
|
module LogSanity
|
11
11
|
class Formatter < Logger::Formatter
|
12
|
+
include ActiveSupport::TaggedLogging::Formatter
|
13
|
+
# tags are ignored when rendering as json
|
14
|
+
# however, tags are prepended when rendering with string_formatter
|
12
15
|
|
13
16
|
def call(severity, timestamp, progname, msg)
|
14
17
|
if msg.is_a? Hash
|
15
|
-
msg
|
18
|
+
msg.reverse_merge!('at' => timestamp) unless msg.key?('at')
|
16
19
|
elsif msg.is_a? String
|
17
20
|
if string_formatter
|
21
|
+
msg = "#{tags_text}#{msg}" if current_tags.any?
|
18
22
|
return string_formatter.call(severity, timestamp, progname, msg)
|
19
23
|
else
|
20
24
|
msg = {'at' => timestamp, 'message' => msg}
|
@@ -30,14 +34,10 @@ module LogSanity
|
|
30
34
|
"#{msg.to_json}\n"
|
31
35
|
end
|
32
36
|
|
33
|
-
# noop; for TaggedLogging compatibility
|
34
|
-
def clear_tags! ; end
|
35
|
-
def tagged(*_) ; yield self ; end
|
36
|
-
def current_tags ; [] ; end
|
37
|
-
|
38
37
|
attr_writer :string_formatter
|
39
38
|
|
40
39
|
def string_formatter
|
40
|
+
return @string_formatter if defined?(@string_formatter)
|
41
41
|
@string_formatter ||= ActiveSupport::Logger::SimpleFormatter.new
|
42
42
|
end
|
43
43
|
|
data/lib/log_sanity/railtie.rb
CHANGED
@@ -10,7 +10,11 @@ module LogSanity
|
|
10
10
|
if app.config.logsanity.enabled
|
11
11
|
orig_formatter = Rails.logger.formatter
|
12
12
|
Rails.logger.formatter = LogSanity::Formatter.new
|
13
|
-
|
13
|
+
if app.config.logsanity.json_strings
|
14
|
+
Rails.logger.formatter.string_formatter = false
|
15
|
+
else
|
16
|
+
Rails.logger.formatter.string_formatter = orig_formatter if orig_formatter
|
17
|
+
end
|
14
18
|
|
15
19
|
if defined?(ActionController)
|
16
20
|
require 'action_controller/log_subscriber'
|
data/lib/log_sanity/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_sanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|