honeybadger 5.8.1 → 5.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/honeybadger/agent.rb +2 -2
- data/lib/honeybadger/context_manager.rb +27 -6
- data/lib/honeybadger/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: 2c74b0590c5e22b6e264874c05c3dcc6a05159d9fe9daa119222c3fada7610da
|
4
|
+
data.tar.gz: acce276df177dc0c91c15a216c65f9ecd78e9d1221d5f4d39bb1c95bbee4f509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcac64eba99e9cad7d31d59d31643080b6725f6e32ee9454e8f4ffb7fc354a6b10b03433ca5469d280c6afca7b6d4df0e7c2aaa5edc858124a416c22d3e52da8
|
7
|
+
data.tar.gz: 7bfe5cfde348795b66d3fe97ff9e4c7bbe41d1b1fd273b39524d1a225dfebd6dcc62c1dae563fb95c5535362e1f9dbe8f08c8798de516941e433a440258449d3
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
|
4
|
+
## [5.9.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.8.1...v5.9.0) (2024-05-09)
|
5
|
+
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* implement local contexts ([#541](https://github.com/honeybadger-io/honeybadger-ruby/issues/541)) ([806718e](https://github.com/honeybadger-io/honeybadger-ruby/commit/806718e76bf8d132a632c75bea124a8b22a4cc97))
|
10
|
+
|
4
11
|
## [5.8.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.8.0...v5.8.1) (2024-05-07)
|
5
12
|
|
6
13
|
|
data/lib/honeybadger/agent.rb
CHANGED
@@ -259,8 +259,8 @@ module Honeybadger
|
|
259
259
|
# (optional).
|
260
260
|
#
|
261
261
|
# @return [self] so that method calls can be chained.
|
262
|
-
def context(context = nil)
|
263
|
-
context_manager.set_context(context) unless context.nil?
|
262
|
+
def context(context = nil, &block)
|
263
|
+
context_manager.set_context(context, &block) unless context.nil?
|
264
264
|
self
|
265
265
|
end
|
266
266
|
|
@@ -21,15 +21,36 @@ module Honeybadger
|
|
21
21
|
# Internal helpers
|
22
22
|
|
23
23
|
|
24
|
-
def set_context(hash)
|
24
|
+
def set_context(hash, &block)
|
25
|
+
local = block_given?
|
25
26
|
@mutex.synchronize do
|
26
|
-
@
|
27
|
-
@
|
27
|
+
@global_context ||= {}
|
28
|
+
@local_context ||= []
|
29
|
+
|
30
|
+
new_context = Context(hash)
|
31
|
+
|
32
|
+
if local
|
33
|
+
@local_context << new_context
|
34
|
+
else
|
35
|
+
@global_context.update(new_context)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if local
|
40
|
+
begin
|
41
|
+
yield
|
42
|
+
ensure
|
43
|
+
@mutex.synchronize { @local_context&.pop }
|
44
|
+
end
|
28
45
|
end
|
29
46
|
end
|
30
47
|
|
31
48
|
def get_context
|
32
|
-
@mutex.synchronize
|
49
|
+
@mutex.synchronize do
|
50
|
+
return @global_context unless @local_context
|
51
|
+
|
52
|
+
@global_context.merge(@local_context.inject({}, :merge))
|
53
|
+
end
|
33
54
|
end
|
34
55
|
|
35
56
|
def set_rack_env(env)
|
@@ -46,10 +67,10 @@ module Honeybadger
|
|
46
67
|
|
47
68
|
def _initialize
|
48
69
|
@mutex.synchronize do
|
49
|
-
@
|
70
|
+
@global_context = nil
|
71
|
+
@local_context = nil
|
50
72
|
@rack_env = nil
|
51
73
|
end
|
52
74
|
end
|
53
|
-
|
54
75
|
end
|
55
76
|
end
|
data/lib/honeybadger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeybadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Honeybadger Industries LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|