log_sanity 1.0.0 → 1.1.0

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: 3cd638933608ceaeffa6e4ac4f9dff3650128a21e7afee0d31f003b6f381c6ff
4
- data.tar.gz: c0753610f32d3828d8d667c06fd6c023c7ad08aed3b167d6851f99c579c446d6
3
+ metadata.gz: ab2d94e3371c9459eaaac83dfe5476a33ff24fabdec99ca07f8821b1cbd14a36
4
+ data.tar.gz: 75a998827a8f1aeb321b51d90b2f7f754636400a73276de37c120089bd035ec1
5
5
  SHA512:
6
- metadata.gz: efbdfe624f62f7e5883cb4e7a10e0f32ad41dea981f8cad792c1b27c18cdd3452dbf8e2345601df786458a428f91fe2e5751979ffb2d318a0558f9352a98ddea
7
- data.tar.gz: 74bf53856c0eabfd35f3d0b90893bba70b7a671579253f2b2dc4440ae4a7017de97cd8410b01a869d7091f975641464b52ab0d7021952eaf09a4b84d05836b2b
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.0.0)
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.1.0)
11
- actionpack (= 6.1.0)
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.1.0)
16
- actionpack (= 6.1.0)
17
- activejob (= 6.1.0)
18
- activerecord (= 6.1.0)
19
- activestorage (= 6.1.0)
20
- activesupport (= 6.1.0)
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.1.0)
23
- actionpack (= 6.1.0)
24
- actionview (= 6.1.0)
25
- activejob (= 6.1.0)
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.1.0)
30
- actionview (= 6.1.0)
31
- activesupport (= 6.1.0)
32
- rack (~> 2.0, >= 2.0.9)
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.1.0)
37
- actionpack (= 6.1.0)
38
- activerecord (= 6.1.0)
39
- activestorage (= 6.1.0)
40
- activesupport (= 6.1.0)
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.1.0)
43
- activesupport (= 6.1.0)
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.1.0)
49
- activesupport (= 6.1.0)
46
+ activejob (6.0.3.4)
47
+ activesupport (= 6.0.3.4)
50
48
  globalid (>= 0.3.6)
51
- activemodel (6.1.0)
52
- activesupport (= 6.1.0)
53
- activerecord (6.1.0)
54
- activemodel (= 6.1.0)
55
- activesupport (= 6.1.0)
56
- activestorage (6.1.0)
57
- actionpack (= 6.1.0)
58
- activejob (= 6.1.0)
59
- activerecord (= 6.1.0)
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
- mimemagic (~> 0.3.2)
63
- activesupport (6.1.0)
59
+ activesupport (6.0.3.4)
64
60
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
- i18n (>= 1.6, < 2)
66
- minitest (>= 5.1)
67
- tzinfo (~> 2.0)
68
- zeitwerk (~> 2.3)
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.1.0)
96
- actioncable (= 6.1.0)
97
- actionmailbox (= 6.1.0)
98
- actionmailer (= 6.1.0)
99
- actionpack (= 6.1.0)
100
- actiontext (= 6.1.0)
101
- actionview (= 6.1.0)
102
- activejob (= 6.1.0)
103
- activemodel (= 6.1.0)
104
- activerecord (= 6.1.0)
105
- activestorage (= 6.1.0)
106
- activesupport (= 6.1.0)
107
- bundler (>= 1.15.0)
108
- railties (= 6.1.0)
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.1.0)
116
- actionpack (= 6.1.0)
117
- activesupport (= 6.1.0)
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 (~> 1.0)
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
- tzinfo (2.0.4)
131
- concurrent-ruby (~> 1.0)
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
@@ -1,4 +1,4 @@
1
- Copyright 2017-2020 thomas morgan
1
+ Copyright 2017-2021 thomas morgan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -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['at'] = timestamp unless msg.key?('at')
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
 
@@ -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
- Rails.logger.formatter.string_formatter = orig_formatter unless app.config.logsanity.json_strings
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'
@@ -1,3 +1,3 @@
1
1
  module LogSanity
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails