lorekeeper 1.11.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +29 -0
- data/CHANGELOG.md +12 -0
- data/README.md +18 -4
- data/lib/lorekeeper/fast_logger.rb +2 -2
- data/lib/lorekeeper/json_logger.rb +3 -3
- data/lib/lorekeeper/version.rb +1 -1
- data/lorekeeper.gemspec +2 -2
- metadata +10 -10
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c3b19f169215f175bd0770ab165fb68203e9aed3e8bd0cb01102d7c758bb67
|
4
|
+
data.tar.gz: 6f9a9302433dec14b3a501b49bfd3610ad3904ab948d0c39390af539f55b3a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62de8ba1553a553cc212bbb3d8a84e2fc8bb98902c3867dfebda2fe7e7f41a716b60d0be81cd281210fef9041972a40757ec9aed724dc468fa775471b62637dc
|
7
|
+
data.tar.gz: '0186d14f8511e2aa0489dba5a98794477e1c7f9f7220af7a3f884947084a0c5d60195d434ed4b406fd3bf252ee5a4a9b3aac3b3a89f6fc832f01c1ddf31fd305'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: build
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rspec
|
28
|
+
- name: Run benchmark
|
29
|
+
run: bundle exec rake benchmark
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 2.0.0
|
2
|
+
* Set `mode: :compat` in Oj.dump to stringify keys
|
3
|
+
* Support Ruby 3.1
|
4
|
+
* Drop support for Ruby < 2.5.0
|
5
|
+
|
6
|
+
# 1.12.0
|
7
|
+
* Remove ZipkinTracer information from stacktrace output
|
8
|
+
* Move CI to GitHub Actions
|
9
|
+
|
10
|
+
# 1.11.1
|
11
|
+
* Modify FastLogger#add to log progname as a message if no message and block are given
|
12
|
+
|
1
13
|
# 1.11.0
|
2
14
|
* Support for activerecord-session_store v2 which calls only silence and not silence_logger
|
3
15
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Lorekeeper
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![build](https://github.com/JordiPolo/lorekeeper/actions/workflows/build.yml/badge.svg)](https://github.com/JordiPolo/lorekeeper/actions/workflows/build.yml)
|
4
4
|
|
5
5
|
LoreKeeper contains a highly optimized JSON logger. It outputs messages as JSON and let the users to add their own customized fields.
|
6
6
|
When used without extra fields it outputs 20% faster than the standard Logger for messages not longer than one line of text.
|
@@ -141,7 +141,7 @@ Will output:
|
|
141
141
|
}
|
142
142
|
```
|
143
143
|
|
144
|
-
This method also accepts a custom message, data and log level
|
144
|
+
This method also accepts a custom message, data and log level:
|
145
145
|
|
146
146
|
```ruby
|
147
147
|
rescue => e
|
@@ -169,16 +169,30 @@ Will output:
|
|
169
169
|
}
|
170
170
|
```
|
171
171
|
|
172
|
-
|
172
|
+
Please note that due to the way Ruby 2.x automatically converts Hash objects to keyword arguments when they come last,
|
173
|
+
you need to explicitly use the `data` keyword argument when you don't pass any other argument afterwards:
|
173
174
|
|
174
175
|
|
176
|
+
```ruby
|
177
|
+
logger.exception(e, "custom msg!", { some: { data: 123 } })
|
178
|
+
# => ArgumentError: unknown keyword: some
|
179
|
+
|
180
|
+
logger.exception(e, "custom msg!", data: { some: { data: 123 } })
|
181
|
+
# => works
|
182
|
+
```
|
183
|
+
|
184
|
+
Ruby 3.x is unaffected by this issue since the conversion is [not done automatically anymore](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/).
|
185
|
+
|
186
|
+
|
187
|
+
The available keyword arguments are `message`, `data` and `level`. They can be used instead of the fixed arguments:
|
188
|
+
|
175
189
|
```ruby
|
176
190
|
rescue => e
|
177
191
|
logger.exception(e, message: "custom msg!", data: { some: { data: 123 } }, level: :warn)
|
178
192
|
end
|
179
193
|
```
|
180
194
|
|
181
|
-
This is
|
195
|
+
This is especially useful when there is no custom message or data:
|
182
196
|
|
183
197
|
```ruby
|
184
198
|
rescue => e
|
@@ -54,9 +54,9 @@ module Lorekeeper
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# This is part of the standard Logger API, we need this to be compatible
|
57
|
-
def add(severity, message_param = nil,
|
57
|
+
def add(severity, message_param = nil, progname = nil, &block)
|
58
58
|
return true if severity < @level
|
59
|
-
message = message_param || (block && block.call)
|
59
|
+
message = message_param || (block && block.call) || progname
|
60
60
|
log_data(severity, message.freeze)
|
61
61
|
end
|
62
62
|
|
@@ -98,7 +98,7 @@ module Lorekeeper
|
|
98
98
|
|
99
99
|
# Some instrumentation libraries pollute the stacktrace and create a large output which may
|
100
100
|
# cause problems with certain logging backends.
|
101
|
-
# Hardcording newrelic
|
101
|
+
# Hardcording newrelic, active_support/callbacks and zipkin-tracer now here.
|
102
102
|
# In the future if this list grows, we may make it configurable.
|
103
103
|
def clean_backtrace(backtrace)
|
104
104
|
@backtrace_cleaner&.clean(backtrace) || backtrace
|
@@ -121,7 +121,7 @@ module Lorekeeper
|
|
121
121
|
EXCEPTION = 'exception'
|
122
122
|
STACK = 'stack'
|
123
123
|
DATA = 'data'
|
124
|
-
BLACKLISTED_FINGERPRINT = %r{newrelic_rpm|active_support/callbacks.rb}.freeze
|
124
|
+
BLACKLISTED_FINGERPRINT = %r{newrelic_rpm|active_support/callbacks.rb|zipkin-tracer}.freeze
|
125
125
|
|
126
126
|
def with_extra_fields(fields)
|
127
127
|
state[:extra_fields] = fields
|
@@ -148,7 +148,7 @@ module Lorekeeper
|
|
148
148
|
fields_to_log[TIMESTAMP] = Time.now.utc.strftime(DATE_FORMAT)
|
149
149
|
fields_to_log[LEVEL] = SEVERITY_NAMES_MAP[severity]
|
150
150
|
|
151
|
-
@iodevice.write(Oj.dump(fields_to_log) << "\n")
|
151
|
+
@iodevice.write(Oj.dump(fields_to_log, mode: :compat, cache_keys: true, cache_str: 5) << "\n")
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
data/lib/lorekeeper/version.rb
CHANGED
data/lorekeeper.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.required_ruby_version = '>= 2.
|
23
|
+
spec.required_ruby_version = '>= 2.5.0'
|
24
24
|
|
25
|
-
spec.add_dependency 'oj', '>= 3.
|
25
|
+
spec.add_dependency 'oj', '>= 3.12', '< 4.0'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'activesupport', '>= 4.0'
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.16', '< 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorekeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordi Polo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.12'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '4.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '3.
|
29
|
+
version: '3.12'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4.0'
|
@@ -183,10 +183,10 @@ executables: []
|
|
183
183
|
extensions: []
|
184
184
|
extra_rdoc_files: []
|
185
185
|
files:
|
186
|
+
- ".github/workflows/build.yml"
|
186
187
|
- ".gitignore"
|
187
188
|
- ".rspec"
|
188
189
|
- ".rubocop.yml"
|
189
|
-
- ".travis.yml"
|
190
190
|
- CHANGELOG.md
|
191
191
|
- Gemfile
|
192
192
|
- LICENSE.txt
|
@@ -205,7 +205,7 @@ homepage: https://github.com/JordiPolo/lorekeeper
|
|
205
205
|
licenses:
|
206
206
|
- MIT
|
207
207
|
metadata: {}
|
208
|
-
post_install_message:
|
208
|
+
post_install_message:
|
209
209
|
rdoc_options: []
|
210
210
|
require_paths:
|
211
211
|
- lib
|
@@ -213,15 +213,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: 2.
|
216
|
+
version: 2.5.0
|
217
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
224
|
-
signing_key:
|
223
|
+
rubygems_version: 3.2.15
|
224
|
+
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Very fast JSON logger
|
227
227
|
test_files: []
|