dry-logger 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d27303efa558c60b1f0f9710b1c9419223d7b421c61b7f6efbea241b54ca486
4
- data.tar.gz: ada0ee3f313045a3cfbcd26e15da7642741d6217efe3e834542935b5efbaa0b9
3
+ metadata.gz: d5b1c6d122b7cb90cf0e9d2a847056d8a610813e0c5dd6b4496deb1b172781be
4
+ data.tar.gz: 4642ad1fb26e02dd1fb660262819d576ab58c64eb376858ebf3f08fe39248d00
5
5
  SHA512:
6
- metadata.gz: 5c42481abe364e3550091fe8d1d8fcfbd3e2b23fa00943ca22e8a13f9d6c20cf7bf7846390498c5fb098c7cb45ff9cef461f9bddde50f4382a719e288af9731d
7
- data.tar.gz: c91f8c1e74e4b1dc7fdeaa62870453e303018e7f5e4b0f25152a805cc20c15c04fea719caef6a6feb756f41291f319dd9ebca3b2275dbedc470e4ff22d5ed3fd
6
+ metadata.gz: 30a77024ebe05dcfc86d6b44e5c3e0262f1a6d27ad8ad4e298e38d763366f8ed3a176014e37b0cc6904dfebee34a18f73a6a13fa61a03d788caf79501a0ddb38
7
+ data.tar.gz: 498b41ab0fd5cd03bf79b8a04ef7a528ba90294777b0f24e427933f77f75880a5297c1a0252a079156fafe274cb05a0528abafe997c08b318b0a2b6d88cd7b53
data/CHANGELOG.md CHANGED
@@ -19,7 +19,15 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
19
19
 
20
20
  ### Security
21
21
 
22
- [Unreleased]: https://github.com/dry-rb/dry-logger/compare/v1.2.1...main
22
+ [Unreleased]: https://github.com/dry-rb/dry-logger/compare/v1.2.2...main
23
+
24
+ ## [1.2.2] - 2026-03-13
25
+
26
+ ### Fixed
27
+
28
+ - Exception when message and metadata have different encodings (@katafrakt in #40)
29
+
30
+ [1.2.2]: https://github.com/dry-rb/dry-logger/compare/v1.2.1...v1.2.2
23
31
 
24
32
  ## [1.2.1] - 2025-12-16
25
33
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2025 Hanakai team
3
+ Copyright (c) 2015-2026 Hanakai team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
@@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
18
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
19
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
20
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
@@ -21,7 +21,7 @@ module Dry
21
21
 
22
22
  # @since 0.1.0
23
23
  # @api private
24
- def initialize( # rubocop:disable Style/ParameterLists
24
+ def initialize(
25
25
  stream:,
26
26
  formatter:,
27
27
  level: DEFAULT_LEVEL,
@@ -53,7 +53,9 @@ module Dry
53
53
  severity: "FATAL",
54
54
  progname: progname,
55
55
  time: Time.now,
56
- log_entry: [message, payload].map(&:to_s).reject(&:empty?).join(SEPARATOR),
56
+ log_entry: [message, payload].map { |s|
57
+ s.to_s.encode("UTF-8", invalid: :replace, undef: :replace, replace: "?")
58
+ }.reject(&:empty?).join(SEPARATOR),
57
59
  exception: exception.class,
58
60
  message: exception.message,
59
61
  backtrace: TAB + exception.backtrace.join(NEW_LINE + TAB)
@@ -44,7 +44,6 @@ module Dry
44
44
 
45
45
  # @since 1.0.0
46
46
  # @api private
47
- # rubocop:disable Metrics/ParameterLists
48
47
  def initialize(clock:, progname:, severity:, tags: EMPTY_ARRAY, message: nil,
49
48
  payload: EMPTY_HASH)
50
49
  @clock = clock
@@ -68,8 +68,19 @@ module Dry
68
68
 
69
69
  # @since 1.0.0
70
70
  # @api private
71
- def %(tokens)
72
- output = value % tokens
71
+ def %(other)
72
+ begin
73
+ output = value % other
74
+ rescue Encoding::CompatibilityError
75
+ sanitized_tokens = other.transform_values { |v|
76
+ if v.respond_to?(:encode)
77
+ v.encode("UTF-8", invalid: :replace, undef: :replace, replace: "?")
78
+ else
79
+ v
80
+ end
81
+ }
82
+ output = value % sanitized_tokens
83
+ end
73
84
  output.strip!
74
85
  output.split(NEW_LINE).map(&:rstrip).join(NEW_LINE)
75
86
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logger
5
- VERSION = "1.2.1"
5
+ VERSION = "1.2.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-12-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: logger
@@ -72,9 +71,9 @@ email:
72
71
  executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files:
75
- - README.md
76
74
  - CHANGELOG.md
77
75
  - LICENSE
76
+ - README.md
78
77
  files:
79
78
  - CHANGELOG.md
80
79
  - LICENSE
@@ -109,7 +108,6 @@ metadata:
109
108
  source_code_uri: https://github.com/dry-rb/dry-logger
110
109
  bug_tracker_uri: https://github.com/dry-rb/dry-logger/issues
111
110
  funding_uri: https://github.com/sponsors/hanami
112
- post_install_message:
113
111
  rdoc_options: []
114
112
  require_paths:
115
113
  - lib
@@ -124,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
122
  - !ruby/object:Gem::Version
125
123
  version: '0'
126
124
  requirements: []
127
- rubygems_version: 3.3.27
128
- signing_key:
125
+ rubygems_version: 3.6.9
129
126
  specification_version: 4
130
127
  summary: Lightweight structured logging for Ruby applications
131
128
  test_files: []