dry-logger 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/LICENSE +1 -1
- data/README.md +5 -12
- data/dry-logger.gemspec +2 -2
- data/lib/dry/logger/constants.rb +1 -1
- data/lib/dry/logger/dispatcher.rb +26 -15
- data/lib/dry/logger/formatters/template.rb +1 -1
- data/lib/dry/logger/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04cd0f59a52a7ad5d6aead697ec9110a8e8f53dff1c6a4f38d382643dc7262fc
|
4
|
+
data.tar.gz: 811b9b8d248e1b6785492c1ce2aa6269620b913749c9c685e0bcda61a0c7cc22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9990fbd5d1a787288bdc8a7ba2457a53ee5a459196c7b6e585c40beab18ca5bdffc8b4adf85d5f49055f2bffa8f60dc85136c384e9ae7a78860872f914a6fc85
|
7
|
+
data.tar.gz: 2bfd9b32587436d6760e157a87a1e3b2043fa6d807d158663c5642eae2fe9cb541f50852fbd411588c4fd0c7eabbeb1e0bb981721382d928cb742ca059c74f2f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.0.4 2024-05-10
|
4
|
+
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
|
8
|
+
- Accept log messages via given block, ensuring compatibility with standard Ruby logger (via #28) (@komidore64)
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Drop support for Ruby 2.7 (via #29) (@timriley)
|
13
|
+
|
14
|
+
[Compare v1.0.3...v1.0.4](https://github.com/dry-rb/dry-logger/compare/v1.0.3...v1.0.4)
|
15
|
+
|
16
|
+
## 1.0.3 2022-12-09
|
17
|
+
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- Support for ruby 2.7 (needs backports gem that *you* need to add to your Gemfile) (via #24) (@solnic)
|
22
|
+
|
23
|
+
|
24
|
+
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-logger/compare/v1.0.2...v1.0.3)
|
25
|
+
|
3
26
|
## 1.0.2 2022-11-24
|
4
27
|
|
5
28
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,22 @@
|
|
1
1
|
<!--- this file is synced from dry-rb/template-gem project -->
|
2
|
+
|
2
3
|
[gem]: https://rubygems.org/gems/dry-logger
|
3
4
|
[actions]: https://github.com/dry-rb/dry-logger/actions
|
4
|
-
[codacy]: https://www.codacy.com/gh/dry-rb/dry-logger
|
5
|
-
[chat]: https://dry-rb.zulipchat.com
|
6
|
-
[inchpages]: http://inch-ci.org/github/dry-rb/dry-logger
|
7
|
-
|
8
|
-
# dry-logger [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
|
9
5
|
|
10
|
-
[![Gem Version](https://badge.fury.io/rb/dry-logger.svg)][gem]
|
11
|
-
[![CI Status](https://github.com/dry-rb/dry-logger/workflows/ci/badge.svg)][actions]
|
12
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5aae4837b97044cfa4537f083ad584e9)][codacy]
|
13
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/5aae4837b97044cfa4537f083ad584e9)][codacy]
|
14
|
-
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-logger.svg?branch=main)][inchpages]
|
6
|
+
# dry-logger [![Gem Version](https://badge.fury.io/rb/dry-logger.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-logger/workflows/CI/badge.svg)][actions]
|
15
7
|
|
16
8
|
## Links
|
17
9
|
|
18
10
|
* [User documentation](https://dry-rb.org/gems/dry-logger)
|
19
11
|
* [API documentation](http://rubydoc.info/gems/dry-logger)
|
12
|
+
* [Forum](https://discourse.dry-rb.org)
|
20
13
|
|
21
14
|
## Supported Ruby versions
|
22
15
|
|
23
16
|
This library officially supports the following Ruby versions:
|
24
17
|
|
25
|
-
* MRI `>=
|
26
|
-
* jruby `>= 9.
|
18
|
+
* MRI `>= 3.0`
|
19
|
+
* jruby `>= 9.4` (not tested on CI)
|
27
20
|
|
28
21
|
## License
|
29
22
|
|
data/dry-logger.gemspec
CHANGED
@@ -8,8 +8,8 @@ require "dry/logger/version"
|
|
8
8
|
|
9
9
|
Gem::Specification.new do |spec|
|
10
10
|
spec.name = "dry-logger"
|
11
|
-
spec.authors = ["Luca Guidi"]
|
12
|
-
spec.email = ["me@lucaguidi.com"]
|
11
|
+
spec.authors = ["Luca Guidi", "Peter Solnica"]
|
12
|
+
spec.email = ["me@lucaguidi.com", "peter@solnica.online"]
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.version = Dry::Logger::VERSION.dup
|
15
15
|
|
data/lib/dry/logger/constants.rb
CHANGED
@@ -110,8 +110,8 @@ module Dry
|
|
110
110
|
# @see Dispatcher#log
|
111
111
|
# @api public
|
112
112
|
# @return [true]
|
113
|
-
def unknown(message = nil, **payload)
|
114
|
-
log(:unknown, message, **payload)
|
113
|
+
def unknown(message = nil, **payload, &block)
|
114
|
+
log(:unknown, message, **payload, &block)
|
115
115
|
end
|
116
116
|
|
117
117
|
# Log an entry with DEBUG severity
|
@@ -119,8 +119,8 @@ module Dry
|
|
119
119
|
# @see Dispatcher#log
|
120
120
|
# @api public
|
121
121
|
# @return [true]
|
122
|
-
def debug(message = nil, **payload)
|
123
|
-
log(:debug, message, **payload)
|
122
|
+
def debug(message = nil, **payload, &block)
|
123
|
+
log(:debug, message, **payload, &block)
|
124
124
|
end
|
125
125
|
|
126
126
|
# Log an entry with INFO severity
|
@@ -128,8 +128,8 @@ module Dry
|
|
128
128
|
# @see Dispatcher#log
|
129
129
|
# @api public
|
130
130
|
# @return [true]
|
131
|
-
def info(message = nil, **payload)
|
132
|
-
log(:info, message, **payload)
|
131
|
+
def info(message = nil, **payload, &block)
|
132
|
+
log(:info, message, **payload, &block)
|
133
133
|
end
|
134
134
|
|
135
135
|
# Log an entry with WARN severity
|
@@ -137,8 +137,8 @@ module Dry
|
|
137
137
|
# @see Dispatcher#log
|
138
138
|
# @api public
|
139
139
|
# @return [true]
|
140
|
-
def warn(message = nil, **payload)
|
141
|
-
log(:warn, message, **payload)
|
140
|
+
def warn(message = nil, **payload, &block)
|
141
|
+
log(:warn, message, **payload, &block)
|
142
142
|
end
|
143
143
|
|
144
144
|
# Log an entry with ERROR severity
|
@@ -146,8 +146,8 @@ module Dry
|
|
146
146
|
# @see Dispatcher#log
|
147
147
|
# @api public
|
148
148
|
# @return [true]
|
149
|
-
def error(message = nil, **payload)
|
150
|
-
log(:error, message, **payload)
|
149
|
+
def error(message = nil, **payload, &block)
|
150
|
+
log(:error, message, **payload, &block)
|
151
151
|
end
|
152
152
|
|
153
153
|
# Log an entry with FATAL severity
|
@@ -155,8 +155,8 @@ module Dry
|
|
155
155
|
# @see Dispatcher#log
|
156
156
|
# @api public
|
157
157
|
# @return [true]
|
158
|
-
def fatal(message = nil, **payload)
|
159
|
-
log(:fatal, message, **payload)
|
158
|
+
def fatal(message = nil, **payload, &block)
|
159
|
+
log(:fatal, message, **payload, &block)
|
160
160
|
end
|
161
161
|
|
162
162
|
BACKEND_METHODS.each do |name|
|
@@ -179,6 +179,9 @@ module Dry
|
|
179
179
|
# @example logging a message
|
180
180
|
# logger.log(:info, "Hello World")
|
181
181
|
#
|
182
|
+
# @example logging a message by passing a block
|
183
|
+
# logger.log(:debug, "Sidecar") { "Hello World" }
|
184
|
+
#
|
182
185
|
# @example logging payload
|
183
186
|
# logger.log(:info, verb: "GET", path: "/users")
|
184
187
|
#
|
@@ -196,17 +199,25 @@ module Dry
|
|
196
199
|
# @param [Symbol] severity The log severity name
|
197
200
|
# @param [String] message Optional message
|
198
201
|
# @param [Hash] payload Optional log entry payload
|
202
|
+
# @yield
|
203
|
+
# @yieldreturn [String] Message to be logged
|
199
204
|
#
|
200
205
|
# @since 1.0.0
|
201
206
|
# @return [true]
|
202
207
|
# @api public
|
203
|
-
def log(severity, message = nil, **payload)
|
208
|
+
def log(severity, message = nil, **payload, &block)
|
204
209
|
case message
|
205
|
-
when Hash then log(severity,
|
210
|
+
when Hash then log(severity, **message, &block)
|
206
211
|
else
|
212
|
+
if block
|
213
|
+
progname = message
|
214
|
+
message = block.call
|
215
|
+
end
|
216
|
+
progname ||= id
|
217
|
+
|
207
218
|
entry = Entry.new(
|
208
219
|
clock: clock,
|
209
|
-
progname:
|
220
|
+
progname: progname,
|
210
221
|
severity: severity,
|
211
222
|
tags: @tags,
|
212
223
|
message: message,
|
data/lib/dry/logger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
+
- Peter Solnica
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2024-05-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rspec
|
@@ -27,6 +28,7 @@ dependencies:
|
|
27
28
|
description: Logging for Ruby
|
28
29
|
email:
|
29
30
|
- me@lucaguidi.com
|
31
|
+
- peter@solnica.online
|
30
32
|
executables: []
|
31
33
|
extensions: []
|
32
34
|
extra_rdoc_files: []
|
@@ -77,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
79
|
- !ruby/object:Gem::Version
|
78
80
|
version: '0'
|
79
81
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.3.27
|
81
83
|
signing_key:
|
82
84
|
specification_version: 4
|
83
85
|
summary: Logging for Ruby
|