dry-logger 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 730cb488952659e0a7499948d6f77e3ed61b7be38e462d7a000479d7e6a8c7f2
4
- data.tar.gz: 81ddc5b02fc960cb3650f1305e19bfc33d21488722455c8bfdcb3e411cb07bf4
3
+ metadata.gz: e066ca44b228d611e0170f99488de6fa110d6ad2bdfea5de5e5f9e7513143019
4
+ data.tar.gz: d563a0fa78660c91e0757a66194269cfc565075d5a6f69356ebd1aec2cb18d6e
5
5
  SHA512:
6
- metadata.gz: 02d8e2eb6e2029a3c29269db001e5e3f50eacf1605efa4cdd62ae01a1e8349b80073e0b591761ed3bc82f7acda5b139a2a03c120c32b3716c27c2d054eee0a64
7
- data.tar.gz: 2f11fec53ac321f0157f3c620944d460a189fa4da112a5b2d617a21171533dcacf17370bf1288d2ef1e4574ab4f35518aca2e280a7063df669768d1c3dda73b6
6
+ metadata.gz: f856780a1ef1fd89828a835c27f7c33b1fd4c5e518c5be8d9251c503d60e75f73b0a8b30e9dbeffdfea90dcc05bf9848fd31fb7ce972eba4b96c63bef6320165
7
+ data.tar.gz: 835f8a12cb10da5a459d4a8cc0b32f8e0c29afff000db89a1014c3686709bf6cd074e344ebcf6a4378c285f024c481df483527a8ec7e92b8fe79aad360628d4a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
- ## 1.0.0
3
+ ## 1.0.1 2022-11-23
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Support for `log_if` in proxied loggers (via 81115320b490034ddf9dfe4f3775322b9271e0cd) (@solnic)
9
+ - Support exceptions and payloads in proxied loggers (via 93b3fd59ebbdc7e63620eb064694d58455df831f) (@solnic)
10
+
11
+
12
+ [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-logger/compare/v1.0.0...v1.0.1)
13
+
14
+ ## 1.0.0 2022-11-17
4
15
 
5
16
  This is a port of the original Hanami logger from hanami-utils extended with support for logging
6
17
  dispatchers that can log to different destinations and plenty more.
@@ -15,12 +15,24 @@ module Dry
15
15
  class Proxy < SimpleDelegator
16
16
  include Core
17
17
 
18
- # @since 0.1.0
19
- # @api public
20
- attr_accessor :log_if
21
-
22
18
  LOG_METHODS.each do |method|
23
- define_method(method) { |entry| __getobj__.public_send(method, entry.message) }
19
+ define_method(method) do |entry|
20
+ if entry.exception?
21
+ if __supports_payload__?(method)
22
+ __getobj__.public_send(method, entry.exception, **entry.payload.except(:exception))
23
+ else
24
+ __getobj__.public_send(method, entry.exception)
25
+ end
26
+ elsif __supports_payload__?(method)
27
+ if entry.message
28
+ __getobj__.public_send(method, entry.message, **entry.payload)
29
+ else
30
+ __getobj__.public_send(method, **entry.payload)
31
+ end
32
+ else
33
+ __getobj__.public_send(method, entry.message)
34
+ end
35
+ end
24
36
  end
25
37
 
26
38
  # @since 1.0.0
@@ -32,6 +44,21 @@ module Dry
32
44
  true
33
45
  end
34
46
  end
47
+
48
+ private
49
+
50
+ # @since 1.0.0
51
+ # @api private
52
+ def __supports_payload__?(method)
53
+ __supported_methods__[method] ||= __getobj__.method(method)
54
+ .parameters.last&.first.equal?(:keyrest)
55
+ end
56
+
57
+ # @since 1.0.0
58
+ # @api private
59
+ def __supported_methods__
60
+ @__supported_methods__ ||= {}
61
+ end
35
62
  end
36
63
  end
37
64
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logger
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-17 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec