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 +4 -4
- data/Gemfile.lock +3 -3
- data/lib/sonnet/rails.rb +27 -3
- data/lib/sonnet/rails_monkeypatch.rb +6 -3
- data/lib/sonnet/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6e3aeaaca85e174a1509ef9ac2876b6685f8bae30dbd940ad650ebf9377563
|
4
|
+
data.tar.gz: 834f727a97a66ee22bb9abf36594e149f473283ffa8d580435bea402fd600b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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 (
|
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.
|
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
|
-
|
38
|
-
|
39
|
-
|
37
|
+
|
38
|
+
module Sonnet
|
39
|
+
module RailsLogger
|
40
|
+
include LoggerSilence
|
41
|
+
end
|
42
|
+
end
|
40
43
|
end
|
data/lib/sonnet/version.rb
CHANGED
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.
|
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:
|
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.
|
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: []
|