sonnet 0.1.8 → 0.2.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: 4c4641035ac6ac2af9894fde837738f9a3b0b1fc8f1d625c8f6ed3ffbb7a8f45
4
- data.tar.gz: 03651c0c7a9162c27f92783ab482147d263e88d0fe972b1ab7a7c65a9b4a51be
3
+ metadata.gz: 2c6e3aeaaca85e174a1509ef9ac2876b6685f8bae30dbd940ad650ebf9377563
4
+ data.tar.gz: 834f727a97a66ee22bb9abf36594e149f473283ffa8d580435bea402fd600b62
5
5
  SHA512:
6
- metadata.gz: b6f95461bbe2e78cbb571822c92ab8eb246bfc9c2920c501ab2cf2333489e5f1b3e1d5dd9c40c933c36091926107be37d3f83a548ec449ba9ccf65b3956620f4
7
- data.tar.gz: 554d1034d5a275fdaec1379ad1ae8f32309a467f2cc1a239086397fe9ba5171d0ec082e51f11ed8af893ceadd06842a793bf0e78edec1c13b911c7181cc53e93
6
+ metadata.gz: b8a66ce8ae9c42fbd211764dea21398fcbdac0bd4fd1142577e02284122bd2a90dcf6632000e8c69743ec4c8082a4f99260beaae1eef64e13b536e53c096274b
7
+ data.tar.gz: 51eb3c154cccab8bc2ac7f1be0d0ae692f9d7c2c764df1eb08208e9fb4b788f46758cde46d54ecc4db32d23f12d1648897f8ce75ae2cd40087809904c9219df2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sonnet (0.1.8)
4
+ sonnet (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -15,7 +15,7 @@ GEM
15
15
  builder
16
16
  minitest (>= 5.0)
17
17
  ruby-progressbar
18
- rake (12.3.2)
18
+ rake (13.0.1)
19
19
  ruby-progressbar (1.10.0)
20
20
 
21
21
  PLATFORMS
@@ -30,4 +30,4 @@ DEPENDENCIES
30
30
  sonnet!
31
31
 
32
32
  BUNDLED WITH
33
- 2.0.1
33
+ 2.1.4
data/lib/sonnet/rails.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'sonnet'
4
+ require 'concurrent'
5
+ require 'fiber'
4
6
 
5
7
  module Sonnet
6
8
  class Rails < ::Rails::Engine
@@ -10,10 +12,8 @@ module Sonnet
10
12
  end
11
13
 
12
14
  module RailsLogger
13
- include ActiveSupport::LoggerThreadSafeLevel
14
- include LoggerSilence
15
-
16
15
  def self.included(base)
16
+
17
17
  base.singleton_class.prepend (Module.new do
18
18
  def extended(logger)
19
19
  super(logger)
@@ -22,6 +22,10 @@ module Sonnet
22
22
  end)
23
23
  end
24
24
 
25
+ def after_initialize
26
+ @local_levels = Concurrent::Map.new(initial_capacity: 2)
27
+ end
28
+
25
29
  def tagged(*tags, &block)
26
30
  if tags.present?
27
31
  with_context(tags: tags.flatten, &block)
@@ -29,6 +33,26 @@ module Sonnet
29
33
  yield self
30
34
  end
31
35
  end
36
+
37
+ def local_log_id
38
+ Fiber.current.__id__
39
+ end
40
+
41
+ def local_level
42
+ @local_levels[local_log_id]
43
+ end
44
+
45
+ def local_level=(level)
46
+ if level
47
+ @local_levels[local_log_id] = level
48
+ else
49
+ @local_levels.delete(local_log_id)
50
+ end
51
+ end
52
+
53
+ def level
54
+ local_level || super
55
+ end
32
56
  end
33
57
 
34
58
  module RailsFormatter
@@ -34,7 +34,10 @@ if ActiveSupport::VERSION::MAJOR < 6
34
34
  end
35
35
  end
36
36
  end
37
- else
38
- ActiveSupport::Deprecation.warn('No longer need to monkeypatch ActiveSupport::TaggedLogging!')
39
- ActiveSupport::Deprecation.warn('No longer need to monkeypatch ActionDispatch::DebugExceptions!')
37
+
38
+ module Sonnet
39
+ module RailsLogger
40
+ include LoggerSilence
41
+ end
42
+ end
40
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sonnet
4
- VERSION = "0.1.8"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Kaufman-Schofield
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ licenses:
112
112
  - MIT
113
113
  metadata:
114
114
  allowed_push_host: https://rubygems.org
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.0.1
131
- signing_key:
130
+ rubygems_version: 3.1.6
131
+ signing_key:
132
132
  specification_version: 4
133
133
  summary: Structured logging for Ruby applications
134
134
  test_files: []