lumberjack 1.2.9 → 1.2.10
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 +4 -4
- data/CHANGELOG.md +43 -2
- data/README.md +33 -4
- data/VERSION +1 -1
- data/lib/lumberjack/device/date_rolling_log_file.rb +1 -1
- data/lib/lumberjack/device/log_file.rb +1 -1
- data/lib/lumberjack/device/multi.rb +1 -1
- data/lib/lumberjack/device/null.rb +1 -1
- data/lib/lumberjack/device/rolling_log_file.rb +1 -1
- data/lib/lumberjack/device/size_rolling_log_file.rb +1 -1
- data/lib/lumberjack/device/writer.rb +1 -1
- data/lib/lumberjack/device.rb +1 -1
- data/lib/lumberjack/formatter/date_time_formatter.rb +1 -1
- data/lib/lumberjack/formatter/exception_formatter.rb +2 -2
- data/lib/lumberjack/formatter/id_formatter.rb +1 -1
- data/lib/lumberjack/formatter/inspect_formatter.rb +1 -1
- data/lib/lumberjack/formatter/object_formatter.rb +1 -1
- data/lib/lumberjack/formatter/pretty_print_formatter.rb +1 -1
- data/lib/lumberjack/formatter/string_formatter.rb +1 -1
- data/lib/lumberjack/formatter/strip_formatter.rb +1 -1
- data/lib/lumberjack/formatter/structured_formatter.rb +1 -1
- data/lib/lumberjack/formatter/truncate_formatter.rb +1 -1
- data/lib/lumberjack/formatter.rb +1 -1
- data/lib/lumberjack/log_entry.rb +2 -2
- data/lib/lumberjack/logger.rb +10 -6
- data/lib/lumberjack/rack/context.rb +1 -1
- data/lib/lumberjack/rack/request_id.rb +1 -1
- data/lib/lumberjack/rack/unit_of_work.rb +1 -1
- data/lib/lumberjack/rack.rb +1 -1
- data/lib/lumberjack/severity.rb +13 -1
- data/lib/lumberjack/template.rb +2 -2
- data/lib/lumberjack.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5ab13ef762e8cdcb989ce1937c117fdbf938edc723c48f338b74edcd5d8e776
|
4
|
+
data.tar.gz: a003d08ef71531551083e4794807d3469fd9691abdc0686e5cc36e6859199922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b527513bd37ca507bfe63c83cd00831f544a9ecdcedc13aeb566a3e74ae4ff0469eefed220da79c7cbeb385aa0fcff249b2480d74c95a1ff21899a8e723afb
|
7
|
+
data.tar.gz: 109411706ed4976f9711d6fcc17dd93bd7700cf72e01f40eaadba5701284e4175aa3791a311a19ab78eaedc34270ff9b16cd4ca394bb01a90b6c29d8e295f8e0
|
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 1.2.10
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Added `with_level` method for compatibility with the latest standard library logger gem.
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- Fixed typo in magic frozen string literal comments. (thanks @andyw8 and @steveclarke)
|
16
|
+
|
7
17
|
## 1.2.9
|
8
18
|
|
9
19
|
### Added
|
20
|
+
|
10
21
|
- Allow passing in formatters as class names when adding them.
|
11
22
|
- Allow passing in formatters initialization arguments when adding them.
|
12
23
|
- Add truncate formatter for capping the length of log messages.
|
@@ -14,54 +25,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
14
25
|
## 1.2.8
|
15
26
|
|
16
27
|
### Added
|
28
|
+
|
17
29
|
- Add `Logger#untagged` to remove previously set logging tags from a block.
|
18
30
|
- Return result of the block when a block is passed to `Logger#tag`.
|
19
31
|
|
20
32
|
## 1.2.7
|
21
33
|
|
22
34
|
### Fixed
|
35
|
+
|
23
36
|
- Allow passing frozen hashes to `Logger#tag`. Tags passed to this method are now duplicated so the logger maintains it's own copy of the hash.
|
24
37
|
|
25
38
|
## 1.2.6
|
26
39
|
|
27
40
|
### Added
|
41
|
+
|
28
42
|
- Add Logger#remove_tag
|
29
43
|
|
30
44
|
### Fixed
|
45
|
+
|
31
46
|
- Fix `Logger#tag` so it only ads to the current block's logger tags instead of the global tags if called inside a `Logger#tag` block.
|
32
47
|
|
33
48
|
|
34
49
|
## 1.2.5
|
35
50
|
|
36
51
|
### Added
|
52
|
+
|
37
53
|
- Add support for bang methods (error!) for setting the log level.
|
38
54
|
|
39
55
|
### Fixed
|
56
|
+
|
40
57
|
- Fixed logic with recursive reference guard in StructuredFormatter so it only suppresses Enumerable references.
|
41
58
|
|
42
59
|
## 1.2.4
|
43
60
|
|
44
61
|
### Added
|
62
|
+
|
45
63
|
- Enhance `ActiveSupport::TaggedLogging` support so code that Lumberjack loggers can be wrapped with a tagged logger.
|
46
64
|
|
47
65
|
## 1.2.3
|
48
66
|
|
49
67
|
### Fixed
|
68
|
+
|
50
69
|
- Fix structured formatter so no-recursive, duplicate references are allowed.
|
51
70
|
|
52
71
|
## 1.2.2
|
53
72
|
|
54
73
|
### Fixed
|
74
|
+
|
55
75
|
- Prevent infinite loops in the structured formatter where objects have backreferences to each other.
|
56
76
|
|
57
77
|
## 1.2.1
|
58
78
|
|
59
79
|
### Fixed
|
80
|
+
|
60
81
|
- Prevent infinite loops where logging a statement triggers the logger.
|
61
82
|
|
62
83
|
## 1.2.0
|
63
84
|
|
64
85
|
### Added
|
86
|
+
|
65
87
|
- Enable compatibility with `ActiveSupport::TaggedLogger` by calling `tagged_logger!` on a logger.
|
66
88
|
- Add `tag_formatter` to logger to specify formatting of tags for output.
|
67
89
|
- Allow adding and removing classes by name to formatters.
|
@@ -78,11 +100,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
78
100
|
## 1.1.1
|
79
101
|
|
80
102
|
### Added
|
103
|
+
|
81
104
|
- Replace Procs in tag values with the value of calling the Proc in log entries.
|
82
105
|
|
83
106
|
## 1.1.0
|
84
107
|
|
85
108
|
### Added
|
109
|
+
|
86
110
|
- Change `Lumberjack::Logger` to inherit from ::Logger
|
87
111
|
- Add support for tags on log messages
|
88
112
|
- Add global tag context for all loggers
|
@@ -96,59 +120,71 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
96
120
|
- Add support for modules in formatters
|
97
121
|
|
98
122
|
### Removed
|
123
|
+
|
99
124
|
- End support for ruby versions < 2.3
|
100
125
|
|
101
126
|
## 1.0.13
|
102
127
|
|
103
128
|
### Added
|
129
|
+
|
104
130
|
- Added `:min_roll_check` option to `Lumberjack::Device::RollingLogFile` to reduce file system checks. Default is now to only check if a file needs to be rolled at most once per second.
|
105
131
|
- Force immutable strings for Ruby versions that support them.
|
106
132
|
|
107
133
|
### Changed
|
134
|
+
|
108
135
|
- Reduce amount of code executed inside a mutex lock when writing to the logger stream.
|
109
136
|
|
110
137
|
## 1.0.12
|
111
138
|
|
112
139
|
### Added
|
140
|
+
|
113
141
|
- Add support for `ActionDispatch` request id for better Rails compatibility.
|
114
142
|
|
115
143
|
## 1.0.11
|
116
144
|
|
117
145
|
### Fixed
|
118
|
-
|
119
|
-
- Fix
|
146
|
+
|
147
|
+
- Fix Ruby 2.4 deprecation warning on Fixnum (thanks @koic).
|
148
|
+
- Fix gemspec files to be flat array (thanks @e2).
|
120
149
|
|
121
150
|
## 1.0.10
|
122
151
|
|
123
152
|
### Added
|
153
|
+
|
124
154
|
- Expose option to manually roll log files.
|
125
155
|
|
126
156
|
### Changed
|
157
|
+
|
127
158
|
- Minor code cleanup.
|
128
159
|
|
129
160
|
## 1.0.9
|
130
161
|
|
131
162
|
### Added
|
163
|
+
|
132
164
|
- Add method so Formatter is compatible with `ActiveSupport` logging extensions.
|
133
165
|
|
134
166
|
## 1.0.8
|
135
167
|
|
136
168
|
### Fixed
|
169
|
+
|
137
170
|
- Fix another internal variable name conflict with `ActiveSupport` logging extensions.
|
138
171
|
|
139
172
|
## 1.0.7
|
140
173
|
|
141
174
|
### Fixed
|
175
|
+
|
142
176
|
- Fix broken formatter attribute method.
|
143
177
|
|
144
178
|
## 1.0.6
|
145
179
|
|
146
180
|
### Fixed
|
181
|
+
|
147
182
|
- Fix internal variable name conflict with `ActiveSupport` logging extensions.
|
148
183
|
|
149
184
|
## 1.0.5
|
150
185
|
|
151
186
|
### Changed
|
187
|
+
|
152
188
|
- Update docs.
|
153
189
|
- Remove autoload calls to make thread safe.
|
154
190
|
- Make compatible with Ruby 2.1.1 Pathname.
|
@@ -157,26 +193,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
157
193
|
## 1.0.4
|
158
194
|
|
159
195
|
### Added
|
196
|
+
|
160
197
|
- Add ability to supply a unit of work id for a block instead of having one generated every time.
|
161
198
|
|
162
199
|
## 1.0.3
|
163
200
|
|
164
201
|
### Fixed
|
202
|
+
|
165
203
|
- Change log file output format to binary to avoid encoding warnings.
|
166
204
|
- Fixed bug in log file rolling that left the file locked.
|
167
205
|
|
168
206
|
## 1.0.2
|
169
207
|
|
170
208
|
### Fixed
|
209
|
+
|
171
210
|
- Remove deprecation warnings under ruby 1.9.3.
|
172
211
|
- Add more error checking around file rolling.
|
173
212
|
|
174
213
|
## 1.0.1
|
175
214
|
|
176
215
|
### Fixed
|
216
|
+
|
177
217
|
- Writes are no longer buffered by default.
|
178
218
|
|
179
219
|
## 1.0.0
|
180
220
|
|
181
221
|
### Added
|
222
|
+
|
182
223
|
- Initial release
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-

|
2
|
-
[](https://codeclimate.com/github/bdurand/lumberjack/maintainability)
|
3
|
-
[](https://github.com/testdouble/standard)
|
4
|
-
|
5
1
|
# Lumberjack
|
6
2
|
|
3
|
+
[](https://github.com/bdurand/lumberjack/actions/workflows/continuous_integration.yml)
|
4
|
+
[](https://github.com/bdurand/lumberjack/actions/workflows/regression_test.yml)
|
5
|
+
[](https://github.com/testdouble/standard)
|
6
|
+
[](https://badge.fury.io/rb/lumberjack)
|
7
|
+
|
7
8
|
Lumberjack is a simple, powerful, and fast logging implementation in Ruby. It uses nearly the same API as the Logger class in the Ruby standard library and as ActiveSupport::BufferedLogger in Rails.
|
8
9
|
|
9
10
|
## Usage
|
@@ -276,3 +277,31 @@ To send log messages to syslog instead of to a file, you could use this (require
|
|
276
277
|
```ruby
|
277
278
|
config.logger = Lumberjack::Logger.new(Lumberjack::SyslogDevice.new)
|
278
279
|
```
|
280
|
+
|
281
|
+
## Installation
|
282
|
+
|
283
|
+
Add this line to your application's Gemfile:
|
284
|
+
|
285
|
+
```ruby
|
286
|
+
gem 'lumberjack'
|
287
|
+
```
|
288
|
+
|
289
|
+
And then execute:
|
290
|
+
```bash
|
291
|
+
$ bundle
|
292
|
+
```
|
293
|
+
|
294
|
+
Or install it yourself as:
|
295
|
+
```bash
|
296
|
+
$ gem install lumberjack
|
297
|
+
```
|
298
|
+
|
299
|
+
## Contributing
|
300
|
+
|
301
|
+
Open a pull request on GitHub.
|
302
|
+
|
303
|
+
Please use the [standardrb](https://github.com/testdouble/standard) syntax and lint your code with `standardrb --fix` before submitting.
|
304
|
+
|
305
|
+
## License
|
306
|
+
|
307
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.10
|
data/lib/lumberjack/device.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Lumberjack
|
4
4
|
class Formatter
|
@@ -16,7 +16,7 @@ module Lumberjack
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call(exception)
|
19
|
-
message = "#{exception.class.name}: #{exception.message}"
|
19
|
+
message = +"#{exception.class.name}: #{exception.message}"
|
20
20
|
trace = exception.backtrace
|
21
21
|
if trace
|
22
22
|
trace = clean_backtrace(trace)
|
data/lib/lumberjack/formatter.rb
CHANGED
data/lib/lumberjack/log_entry.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Lumberjack
|
4
4
|
# An entry in a log is a data structure that captures the log message as well as
|
@@ -66,7 +66,7 @@ module Lumberjack
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def tags_to_s
|
69
|
-
tags_string = ""
|
69
|
+
tags_string = +""
|
70
70
|
tags&.each { |name, value| tags_string << " #{name}:#{value.inspect}" }
|
71
71
|
tags_string
|
72
72
|
end
|
data/lib/lumberjack/logger.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Lumberjack
|
4
4
|
# Logger is a thread safe logging object. It has a compatible API with the Ruby
|
@@ -118,15 +118,19 @@ module Lumberjack
|
|
118
118
|
# @param [Integer, Symbol, String] value The severity level.
|
119
119
|
# @return [void]
|
120
120
|
def level=(value)
|
121
|
-
@level =
|
122
|
-
value
|
123
|
-
else
|
124
|
-
Severity.label_to_level(value)
|
125
|
-
end
|
121
|
+
@level = Severity.coerce(value)
|
126
122
|
end
|
127
123
|
|
128
124
|
alias_method :sev_threshold=, :level=
|
129
125
|
|
126
|
+
# Adjust the log level during the block execution for the current Fiber only.
|
127
|
+
#
|
128
|
+
# @param [Integer, Symbol, String] severity The severity level.
|
129
|
+
# @return [Object] The result of the block.
|
130
|
+
def with_level(severity, &block)
|
131
|
+
push_thread_local_value(:lumberjack_logger_level, Severity.coerce(severity), &block)
|
132
|
+
end
|
133
|
+
|
130
134
|
# Set the Lumberjack::Formatter used to format objects for logging as messages.
|
131
135
|
#
|
132
136
|
# @param [Lumberjack::Formatter, Object] value The formatter to use.
|
data/lib/lumberjack/rack.rb
CHANGED
data/lib/lumberjack/severity.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Lumberjack
|
4
4
|
# The standard severity levels for logging messages.
|
@@ -29,6 +29,18 @@ module Lumberjack
|
|
29
29
|
def label_to_level(label)
|
30
30
|
SEVERITY_LABELS.index(label.to_s.upcase) || UNKNOWN
|
31
31
|
end
|
32
|
+
|
33
|
+
# Coerce a value to a severity level.
|
34
|
+
#
|
35
|
+
# @param [Integer, String, Symbol] value The value to coerce.
|
36
|
+
# @return [Integer] The severity level.
|
37
|
+
def coerce(value)
|
38
|
+
if value.is_a?(Integer)
|
39
|
+
value
|
40
|
+
else
|
41
|
+
label_to_level(value)
|
42
|
+
end
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
34
46
|
end
|
data/lib/lumberjack/template.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Lumberjack
|
4
4
|
# A template converts entries to strings. Templates can contain the following place holders to
|
@@ -98,7 +98,7 @@ module Lumberjack
|
|
98
98
|
def tag_args(tags, tag_vars)
|
99
99
|
return [nil] * (tag_vars.size + 1) if tags.nil? || tags.size == 0
|
100
100
|
|
101
|
-
tags_string = ""
|
101
|
+
tags_string = +""
|
102
102
|
tags.each do |name, value|
|
103
103
|
unless value.nil? || tag_vars.include?(name)
|
104
104
|
value = value.to_s
|
data/lib/lumberjack.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rbconfig"
|
4
4
|
require "time"
|
5
5
|
require "securerandom"
|
6
6
|
require "logger"
|
7
|
+
require "fiber"
|
7
8
|
|
8
9
|
module Lumberjack
|
9
10
|
LINE_SEPARATOR = ((RbConfig::CONFIG["host_os"] =~ /mswin/i) ? "\r\n" : "\n")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lumberjack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.4.
|
91
|
+
rubygems_version: 3.4.20
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: A simple, powerful, and very fast logging utility that can be a drop in replacement
|