betterlog 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/betterlog.gemspec +3 -3
- data/lib/betterlog/log.rb +16 -16
- data/lib/betterlog/log/event.rb +2 -2
- data/lib/betterlog/notifiers.rb +1 -1
- data/lib/betterlog/version.rb +1 -1
- data/spec/betterlog/log/event_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d827dd5737b98f60f8e2a6aa64d3f9651d976b2f30a0547154d48e45a893f8
|
4
|
+
data.tar.gz: 488821623937b7b5143759afa38ca371cbb5541340423b8ca441e57904c26299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158de8bb4b4de6006b24d99b4f5cc709c91445438e49479fa55d1dcd52e78ae6153c9039022c92aa2832f88e721b068c82094b32ef054772cd5c6a759ec23a79
|
7
|
+
data.tar.gz: 4fface48b8f0a17697b14ed24cfebff578b2621c09a8a15c199aa518cd0d978c2f7423154ccf4c548fbb6ad088b24de79ec35404e1f80a45d980afbf80f53eb9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.12.
|
1
|
+
0.12.2
|
data/betterlog.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: betterlog 0.12.
|
2
|
+
# stub: betterlog 0.12.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "betterlog".freeze
|
6
|
-
s.version = "0.12.
|
6
|
+
s.version = "0.12.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 = "2020-04-
|
11
|
+
s.date = "2020-04-20"
|
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]
|
data/lib/betterlog/log.rb
CHANGED
@@ -98,7 +98,7 @@ module Betterlog
|
|
98
98
|
result = time_block(&block)
|
99
99
|
rescue => error
|
100
100
|
e = Log::Event.ify(error)
|
101
|
-
rest |= e.
|
101
|
+
rest |= e.as_json.subhash(:error_class, :backtrace, :message)
|
102
102
|
rest[:message] = "#{rest[:message].inspect} while measuring metric #{name}"
|
103
103
|
raise error
|
104
104
|
ensure
|
@@ -125,6 +125,21 @@ module Betterlog
|
|
125
125
|
instance.context(data_hash)
|
126
126
|
end
|
127
127
|
|
128
|
+
def emit(event)
|
129
|
+
l = caller_locations.reverse_each.each_cons(3).find { |c, n1, n2|
|
130
|
+
n2.absolute_path =~ /betterlog\/log\.rb/ and break c # TODO check if this still works
|
131
|
+
}
|
132
|
+
if l
|
133
|
+
event[:location] = [ l.absolute_path, l.lineno ] * ?:
|
134
|
+
end
|
135
|
+
event[:emitter] = self.class.name.downcase
|
136
|
+
notify(event)
|
137
|
+
logger.send(event.severity.to_sym, event.to_json)
|
138
|
+
self
|
139
|
+
ensure
|
140
|
+
GlobalMetadata.data.clear
|
141
|
+
end
|
142
|
+
|
128
143
|
private
|
129
144
|
|
130
145
|
def protect
|
@@ -158,21 +173,6 @@ module Betterlog
|
|
158
173
|
)
|
159
174
|
end
|
160
175
|
|
161
|
-
def emit(event)
|
162
|
-
l = caller_locations.reverse_each.each_cons(3).find { |c, n1, n2|
|
163
|
-
n2.absolute_path =~ /betterlog\/log\.rb/ and break c # TODO check if this still works
|
164
|
-
}
|
165
|
-
if l
|
166
|
-
event[:location] = [ l.absolute_path, l.lineno ] * ?:
|
167
|
-
end
|
168
|
-
event[:emitter] = self.class.name.downcase
|
169
|
-
notify(event)
|
170
|
-
logger.send(event.severity.to_sym, event.to_json)
|
171
|
-
self
|
172
|
-
ensure
|
173
|
-
GlobalMetadata.data.clear
|
174
|
-
end
|
175
|
-
|
176
176
|
def notify(event)
|
177
177
|
if event.notify?
|
178
178
|
Notifiers.notify(event)
|
data/lib/betterlog/log/event.rb
CHANGED
data/lib/betterlog/notifiers.rb
CHANGED
data/lib/betterlog/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Betterlog::Log::Event do
|
4
|
-
describe '#
|
4
|
+
describe '#as_json' do
|
5
5
|
it 'dups hash before returning it' do
|
6
6
|
event = described_class.new
|
7
|
-
expect(event.
|
7
|
+
expect(event.as_json).not_to equal event.instance_variable_get(:@data)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
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.12.
|
4
|
+
version: 0.12.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: 2020-04-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|