lamian 1.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +10 -0
- data/lib/lamian/engine.rb +6 -3
- data/lib/lamian/sentry_scope_patch.rb +17 -0
- data/lib/lamian/version.rb +1 -1
- data/lib/lamian.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c89ac71145ec9af5b58ff7838d164aacb7b475b927e6c2aa18d082475259490
|
4
|
+
data.tar.gz: 8bd8d8463613bb9930e8d23b36a5a964b35ac101eaead9cfb0061a14636eb29c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a8f70c8575eea0c877d403f3c4201befc03e5e8e4cf45d52da7bcfd09ea4a43e583c212089aefa6d686f200579129c0ff30128401f68dd5c1e1abeef49b8c85
|
7
|
+
data.tar.gz: 4668462108c871ded252b6fc90d3dde9ac6178c29bf5d067076527ea11cd1c6004f9eacf9518c305330ce3ef46f99fdb297b50812469373829d88f560aafc215
|
data/.github/workflows/test.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lamian (1.
|
4
|
+
lamian (1.6.0)
|
5
5
|
rails (>= 4.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -106,7 +106,7 @@ GEM
|
|
106
106
|
faraday-rack (1.0.0)
|
107
107
|
globalid (0.5.2)
|
108
108
|
activesupport (>= 5.0)
|
109
|
-
i18n (1.8.
|
109
|
+
i18n (1.8.11)
|
110
110
|
concurrent-ruby (~> 1.0)
|
111
111
|
launchy (2.5.0)
|
112
112
|
addressable (~> 2.7)
|
@@ -235,9 +235,9 @@ GEM
|
|
235
235
|
sprockets (4.0.2)
|
236
236
|
concurrent-ruby (~> 1.0)
|
237
237
|
rack (> 1, < 3)
|
238
|
-
sprockets-rails (3.
|
239
|
-
actionpack (>=
|
240
|
-
activesupport (>=
|
238
|
+
sprockets-rails (3.4.0)
|
239
|
+
actionpack (>= 5.2)
|
240
|
+
activesupport (>= 5.2)
|
241
241
|
sprockets (>= 3.0.0)
|
242
242
|
symbiont-ruby (0.7.0)
|
243
243
|
thor (1.1.0)
|
data/README.md
CHANGED
@@ -47,6 +47,16 @@ You should add Lamian appender to the SematicLogger appenders like this:
|
|
47
47
|
SemanticLogger.add_appender(appender: Lamian::SemanticLoggerAppender.new)
|
48
48
|
```
|
49
49
|
|
50
|
+
### Patching Sentry Scope
|
51
|
+
|
52
|
+
If you want to send events asynchronously you need to patch `Sentry::Scope`.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
# Somewhere in a initializer.
|
56
|
+
|
57
|
+
Sentry::Scope.prepend(Lamian::SentryScopePatch)
|
58
|
+
```
|
59
|
+
|
50
60
|
## Raven (deprecated)
|
51
61
|
|
52
62
|
### Usage
|
data/lib/lamian/engine.rb
CHANGED
@@ -17,10 +17,13 @@ module Lamian
|
|
17
17
|
|
18
18
|
config.after_initialize do
|
19
19
|
# :nocov:
|
20
|
-
|
21
|
-
|
20
|
+
if defined?(Sentry) && Sentry.initialized?
|
21
|
+
Sentry.configuration.before_send = rebuild_before_send
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
if defined?(Sidekiq::ServerMiddleware)
|
25
|
+
Lamian::SidekiqSentryMiddleware.include(Sidekiq::ServerMiddleware)
|
26
|
+
end
|
24
27
|
# :nocov:
|
25
28
|
end
|
26
29
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lamian
|
4
|
+
# Patch for the `Sentry::Scope`. Extends the attribute accessor
|
5
|
+
# by adding an automatic lamian log dump.
|
6
|
+
# You should use this patch if you want to asynchronously send events.
|
7
|
+
# @example Prepending `Sentry::Scope` class
|
8
|
+
# Sentry::Scope.prepend(Lamian::SentryScopePatch) #=> Sentry::Scope
|
9
|
+
module SentryScopePatch
|
10
|
+
# Extra data defined in the scope.
|
11
|
+
# @return [String]
|
12
|
+
def extra
|
13
|
+
log = Lamian.dump(format: :txt)&.slice(0, Lamian.config.raven_log_size_limit)
|
14
|
+
log ? super.merge!(Lamian::SENTRY_EXTRA_KEY => log) : super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/lamian/version.rb
CHANGED
data/lib/lamian.rb
CHANGED
@@ -14,6 +14,7 @@ module Lamian
|
|
14
14
|
autoload :SidekiqRavenMiddleware, "lamian/sidekiq_raven_middleware"
|
15
15
|
autoload :SidekiqSentryMiddleware, "lamian/sidekiq_sentry_middleware"
|
16
16
|
autoload :SemanticLoggerAppender, "lamian/semantic_logger_appender"
|
17
|
+
autoload :SentryScopePatch, "lamian/sentry_scope_patch"
|
17
18
|
|
18
19
|
# The key under which logs are stored in the Sentry extra data.
|
19
20
|
SENTRY_EXTRA_KEY = :lamian_log
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lamian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JelF
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/lamian/rails_views/exception_notifier/_request_log.text.erb
|
238
238
|
- lib/lamian/raven_context_extension.rb
|
239
239
|
- lib/lamian/semantic_logger_appender.rb
|
240
|
+
- lib/lamian/sentry_scope_patch.rb
|
240
241
|
- lib/lamian/sidekiq_raven_middleware.rb
|
241
242
|
- lib/lamian/sidekiq_sentry_middleware.rb
|
242
243
|
- lib/lamian/version.rb
|
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
260
|
- !ruby/object:Gem::Version
|
260
261
|
version: '0'
|
261
262
|
requirements: []
|
262
|
-
rubygems_version: 3.
|
263
|
+
rubygems_version: 3.3.24
|
263
264
|
signing_key:
|
264
265
|
specification_version: 4
|
265
266
|
summary: Add logs to your error messages
|