betterlog 0.15.1 → 0.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +6 -3
- data/Dockerfile +2 -2
- data/VERSION +1 -1
- data/betterlog.gemspec +4 -4
- data/lib/betterlog/log.rb +1 -1
- data/lib/betterlog/log/event.rb +9 -1
- data/lib/betterlog/log/event_formatter.rb +1 -1
- data/lib/betterlog/log_event_formatter.rb +1 -1
- data/lib/betterlog/version.rb +1 -1
- data/spec/betterlog/log_spec.rb +11 -0
- 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: 27e6af480e7ec65272867c76176a644ce2c925e853aff060074840f17ad5d714
|
4
|
+
data.tar.gz: 0531306c3a7b421691b67e78be5d7e960c91cb421e4e2db22657cdbe2cc248e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '096483149f340b0cb1f8fc5253ad033e7ce7a4dc4abdd2c07c78beb464a8cd95538b956c4f82b45133d2287cfb767c754fdd1fd8079de780534ed9def9532267'
|
7
|
+
data.tar.gz: 610301cb7fc4b028816d78f5ce5f8330b5c04e291ff5099035af49ab3de85def2048455276767b0253f60bebc9d7dd1eb9fb3c3902414ae60e79bf4057ac054b
|
data/.semaphore/semaphore.yml
CHANGED
@@ -16,6 +16,7 @@ blocks:
|
|
16
16
|
commands:
|
17
17
|
- sem-version ruby 2.7.2
|
18
18
|
- cache restore gems-$SEMAPHORE_GIT_BRANCH,gems-master
|
19
|
+
- bundle config set path 'vendor/bundle'
|
19
20
|
- bundle config jobs $(getconf _NPROCESSORS_ONLN)
|
20
21
|
- bundle install
|
21
22
|
- cache store gems-$SEMAPHORE_GIT_BRANCH vendor/bundle
|
@@ -34,13 +35,14 @@ blocks:
|
|
34
35
|
|
35
36
|
# Setup gems
|
36
37
|
- cache restore gems-$SEMAPHORE_GIT_BRANCH,gems-master
|
38
|
+
- bundle config set path 'vendor/bundle'
|
37
39
|
- bundle config jobs $(getconf _NPROCESSORS_ONLN)
|
38
40
|
- bundle install
|
39
41
|
|
40
42
|
jobs:
|
41
43
|
- name: RSpec Unit Tests
|
42
44
|
commands:
|
43
|
-
- rake
|
45
|
+
- bundle exec rake
|
44
46
|
|
45
47
|
- name: Building Docker Image
|
46
48
|
task:
|
@@ -51,10 +53,11 @@ blocks:
|
|
51
53
|
prologue:
|
52
54
|
commands:
|
53
55
|
- gcloud auth activate-service-account --key-file=.secrets/gcp.json
|
54
|
-
- gcloud auth configure-docker -q
|
56
|
+
- gcloud auth configure-docker -q eu.gcr.io
|
55
57
|
- checkout
|
56
58
|
|
57
59
|
jobs:
|
58
60
|
- name: Building and pushing
|
59
61
|
commands:
|
60
|
-
- make build
|
62
|
+
- make build
|
63
|
+
- test "$SEMAPHORE_GIT_BRANCH" = "master" && make push-latest
|
data/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM alpine:3.12.
|
1
|
+
FROM alpine:3.12.3 AS builder
|
2
2
|
|
3
3
|
# Update/Upgrade/Add packages for building
|
4
4
|
|
@@ -18,7 +18,7 @@ RUN go get -u github.com/betterplace/go-init
|
|
18
18
|
|
19
19
|
RUN make setup all
|
20
20
|
|
21
|
-
FROM alpine:3.12.
|
21
|
+
FROM alpine:3.12.3 AS runner
|
22
22
|
|
23
23
|
# Update/Upgrade/Add packages
|
24
24
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.15.
|
1
|
+
0.15.2
|
data/betterlog.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: betterlog 0.15.
|
2
|
+
# stub: betterlog 0.15.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "betterlog".freeze
|
6
|
-
s.version = "0.15.
|
6
|
+
s.version = "0.15.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["betterplace Developers".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2021-02-03"
|
12
12
|
s.description = "This library provides structure json logging for our rails projects".freeze
|
13
13
|
s.email = "developers@betterplace.org".freeze
|
14
14
|
s.executables = ["betterlog".freeze, "betterlog_pusher".freeze, "betterlog_sink".freeze]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = [".gitignore".freeze, ".semaphore/semaphore.yml".freeze, "Dockerfile".freeze, "Gemfile".freeze, "LICENSE".freeze, "Makefile".freeze, "README.md".freeze, "Rakefile".freeze, "TODO.md".freeze, "VERSION".freeze, "betterlog.gemspec".freeze, "betterlog/config.go".freeze, "betterlog/healthz.go".freeze, "betterlog/redis_cert_cache.go".freeze, "bin/betterlog".freeze, "bin/betterlog_pusher".freeze, "bin/betterlog_sink".freeze, "cloudbuild.yaml".freeze, "cmd/betterlog-server/LICENSE".freeze, "cmd/betterlog-server/main.go".freeze, "config/log.yml".freeze, "go.mod".freeze, "go.sum".freeze, "lib/betterlog.rb".freeze, "lib/betterlog/global_metadata.rb".freeze, "lib/betterlog/log.rb".freeze, "lib/betterlog/log/event.rb".freeze, "lib/betterlog/log/event_formatter.rb".freeze, "lib/betterlog/log/severity.rb".freeze, "lib/betterlog/log_event_formatter.rb".freeze, "lib/betterlog/logger.rb".freeze, "lib/betterlog/notifiers.rb".freeze, "lib/betterlog/railtie.rb".freeze, "lib/betterlog/version.rb".freeze, "spec/betterlog/global_metadata_spec.rb".freeze, "spec/betterlog/log/event_spec.rb".freeze, "spec/betterlog/log/severity_spec.rb".freeze, "spec/betterlog/log_spec.rb".freeze, "spec/betterlog/logger_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
17
17
|
s.homepage = "http://github.com/betterplace/betterlog".freeze
|
18
18
|
s.rdoc_options = ["--title".freeze, "Betterlog".freeze, "--main".freeze, "README.md".freeze]
|
19
|
-
s.rubygems_version = "3.
|
19
|
+
s.rubygems_version = "3.2.5".freeze
|
20
20
|
s.summary = "Structured logging support for bp".freeze
|
21
21
|
s.test_files = ["spec/betterlog/global_metadata_spec.rb".freeze, "spec/betterlog/log/event_spec.rb".freeze, "spec/betterlog/log/severity_spec.rb".freeze, "spec/betterlog/log_spec.rb".freeze, "spec/betterlog/logger_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
22
22
|
|
data/lib/betterlog/log.rb
CHANGED
@@ -138,7 +138,7 @@ module Betterlog
|
|
138
138
|
end
|
139
139
|
event[:emitter] = self.class.name.downcase
|
140
140
|
notify(event)
|
141
|
-
logger.send(event.severity.to_sym, event
|
141
|
+
logger.send(event.severity.to_sym, JSON.generate(event))
|
142
142
|
self
|
143
143
|
ensure
|
144
144
|
GlobalMetadata.data.clear
|
data/lib/betterlog/log/event.rb
CHANGED
@@ -75,7 +75,15 @@ module Betterlog
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def to_json(*a)
|
78
|
-
|
78
|
+
JSON.generate(as_json)
|
79
|
+
rescue
|
80
|
+
# Sometimes rails logging messages contain invalid utf-8 characters
|
81
|
+
# generating various standard errors. Let's fallback to a barebones
|
82
|
+
# event with just a cleaned up message for these cases.
|
83
|
+
JSON.generate({
|
84
|
+
severity: @data[:severity],
|
85
|
+
message: @data.fetch(:message, '').encode('utf-8', invalid: :replace, undef: :replace, replace: ''),
|
86
|
+
})
|
79
87
|
end
|
80
88
|
|
81
89
|
def format(*args)
|
data/lib/betterlog/version.rb
CHANGED
data/spec/betterlog/log_spec.rb
CHANGED
@@ -26,6 +26,17 @@ describe Betterlog::Log do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
describe 'Log::Event.to_json' do
|
30
|
+
it 'can be called' do
|
31
|
+
expect(event.to_json).to be_present
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'can handle invalid UTF-8 characters' do
|
35
|
+
event = Log::Event.ify("foo\xCEbar")
|
36
|
+
expect(event.to_json).to eq(JSON(severity: "DEBUG", message: 'foobar'))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
describe '.parse' do
|
30
41
|
it 'can parse an event as a JSON document' do
|
31
42
|
expect(Log::Event.parse(event.to_json)).to eq event
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- betterplace Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: '0'
|
283
283
|
requirements: []
|
284
|
-
rubygems_version: 3.
|
284
|
+
rubygems_version: 3.2.5
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Structured logging support for bp
|