logster 2.11.1 → 2.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logster/logger.rb +8 -13
- data/lib/logster/version.rb +1 -1
- data/test/logster/test_logger.rb +6 -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: ac4fd2b906013693d1b76679876762a938c333642df5306c0e1c7b1e53c01e04
|
4
|
+
data.tar.gz: a6980fcc69d06ce88f821c83662400b5a17887a8896fd06df096a06c7cffa40f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea5f6d1da6046eb5cad955ac63b435ed98597769bf8da58c6fccac41ab48d4fb6bb06f0b25b8b993224e9f1940a60b4deed2750b55072d5be3b84d6abfe64cc7
|
7
|
+
data.tar.gz: 98cecbb8c155368f57d70482e57be3e04ef780c06c8c983255aed44e09a78af176bbe375f78b685788e6cf6c9748be51ff521a00d11075004bdedc424fe535a8
|
data/CHANGELOG.md
CHANGED
data/lib/logster/logger.rb
CHANGED
@@ -4,7 +4,7 @@ require 'logger'
|
|
4
4
|
|
5
5
|
module Logster
|
6
6
|
class Logger < ::Logger
|
7
|
-
LOGSTER_ENV = "logster_env"
|
7
|
+
LOGSTER_ENV = "logster_env"
|
8
8
|
|
9
9
|
attr_accessor :store, :skip_store
|
10
10
|
attr_reader :chained
|
@@ -12,21 +12,17 @@ module Logster
|
|
12
12
|
def initialize(store)
|
13
13
|
super(nil)
|
14
14
|
@store = store
|
15
|
-
@override_levels = nil
|
16
15
|
@chained = []
|
17
16
|
@skip_store = false
|
17
|
+
@logster_override_level_key = "logster_override_level_#{object_id}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def override_level=(val)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@override_levels = nil if ol.length == 0
|
27
|
-
elsif val
|
28
|
-
(@override_levels ||= {})[tid] = val
|
29
|
-
end
|
21
|
+
Thread.current[@logster_override_level_key] = val
|
22
|
+
end
|
23
|
+
|
24
|
+
def override_level
|
25
|
+
Thread.current[@logster_override_level_key]
|
30
26
|
end
|
31
27
|
|
32
28
|
def chain(logger)
|
@@ -55,8 +51,7 @@ module Logster
|
|
55
51
|
end
|
56
52
|
|
57
53
|
def level
|
58
|
-
|
59
|
-
(ol && ol[Thread.current.object_id]) || @level
|
54
|
+
Thread.current[@logster_override_level_key] || @level
|
60
55
|
end
|
61
56
|
|
62
57
|
def add_with_opts(severity, message = nil, progname = progname(), opts = nil, &block)
|
data/lib/logster/version.rb
CHANGED
data/test/logster/test_logger.rb
CHANGED
@@ -26,6 +26,12 @@ class TestLogger < Minitest::Test
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_per_thread_override
|
29
|
+
logger2 = Logster::Logger.new(@store)
|
30
|
+
logger2.override_level = 2
|
31
|
+
|
32
|
+
# we should not leak between objects
|
33
|
+
assert_nil @logger.override_level
|
34
|
+
|
29
35
|
@logger.override_level = 2
|
30
36
|
|
31
37
|
@logger.add(0, "test", "prog", backtrace: "backtrace", env: { a: "x" })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|