lorekeeper 1.11.1 → 1.12.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 +4 -0
- data/README.md +18 -4
- data/lib/lorekeeper/json_logger.rb +2 -2
- data/lib/lorekeeper/version.rb +1 -1
- metadata +3 -3
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3ae6a493b8fc903122557d5144db57633e3c72a881cb4bc88ad458d438f7dc
|
4
|
+
data.tar.gz: 69ba8f5fd5ea48d6325f27ae777c91e857e28c5f7e6093cef71aa427cfcb8266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b3b703f5182598b73f0c86411b9a627060eed1e0c59ddd1b9507dd3e9f28b5c3239e2e48a59bdf42edc017fa5df1acb4ba8aee5f502f73f21ff6fcc1876c8b4
|
7
|
+
data.tar.gz: 8925f11071fbccff8ddca89066a473b9286c8aedd87f9b76c3f872388e83ead883f2b78fe3645e71753009535f9e7b2e09e0e3921b4f64883a86f49c3737da72
|
@@ -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']
|
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
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
|
@@ -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
|
data/lib/lorekeeper/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordi Polo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -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
|