sidekiq_middlewares 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq_middlewares/error_logger.rb +4 -3
- data/lib/sidekiq_middlewares/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 534f7313bae3b08136b2f08384da9df76280efaa
|
4
|
+
data.tar.gz: eee717e967de126db6387e50be66b13babdf8aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35e6901b3238abc187755126733391eecf37c5516622e4ccab92f954785b0d6e36f475efc591921fae062d29a47ec2293cb693791b8a3d44bf12992f282cca3
|
7
|
+
data.tar.gz: 675657f10a096beb5369a2f7481e29b0a6c590eb4a167cc110dd98034e0f521bd14977da863ce53cb3a2bb4c3eaa7c0ec9b223238ab926948a55e0d3ffe732a4
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module SidekiqMiddlewares
|
2
2
|
class ErrorLogger
|
3
|
-
def initialize(
|
4
|
-
@logger = logger
|
3
|
+
def initialize(opts = {})
|
4
|
+
@logger = opts[:logger] || raise(ArgumentError, 'missing keyword: logger')
|
5
|
+
@formatter = opts[:formatter] || proc { |message| message }
|
5
6
|
end
|
6
7
|
|
7
8
|
def call(*_args)
|
8
9
|
begin
|
9
10
|
yield
|
10
11
|
rescue => ex
|
11
|
-
@logger.error
|
12
|
+
@logger.error(@formatter.call(ex))
|
12
13
|
raise
|
13
14
|
end
|
14
15
|
end
|