chalk-log 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chalk-log/layout.rb +3 -8
- data/lib/chalk-log/version.rb +1 -1
- data/test/functional/log.rb +7 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51740a04663dc5789cf617d795902c878753da4d
|
4
|
+
data.tar.gz: ddce4867174594d0e261b1451cf8fcf2bb195e44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 599c1125ff94b46bd016c78a45126b6648bedd03a0fe92d20c10d9595a57eaf81e9e9c9e64ef2862545525f07af68b1a4df0dd68ba70fe90a5fe96e3eb4607c3
|
7
|
+
data.tar.gz: f9f6143c0c9cac78ee48e5629d01b7b849766047dd3bfcf959337f4c0231846083584a3173326f73875b385e3c1a877dd1171b93b0edf7e1c2e174ae04553326
|
data/lib/chalk-log/layout.rb
CHANGED
@@ -50,6 +50,7 @@ class Chalk::Log::Layout < ::Logging::Layout
|
|
50
50
|
|
51
51
|
# Data provided by blocks may not be arrays yet
|
52
52
|
data = [data] unless data.kind_of?(Array)
|
53
|
+
data = data.dup # Make a private copy that we can mutate
|
53
54
|
info = data.pop if data.last.kind_of?(Hash)
|
54
55
|
error = data.pop if data.last.kind_of?(Exception)
|
55
56
|
message = data.pop if data.last.kind_of?(String)
|
@@ -66,7 +67,7 @@ class Chalk::Log::Layout < ::Logging::Layout
|
|
66
67
|
span: span.to_s,
|
67
68
|
message: message,
|
68
69
|
error: error,
|
69
|
-
info: (info &&
|
70
|
+
info: (info && (contextual_info || {}).merge(info)) || contextual_info,
|
70
71
|
pid: pid
|
71
72
|
)
|
72
73
|
end
|
@@ -95,7 +96,7 @@ class Chalk::Log::Layout < ::Logging::Layout
|
|
95
96
|
if info
|
96
97
|
message << ' ' if message
|
97
98
|
message ||= ''
|
98
|
-
|
99
|
+
message << format_hash(info)
|
99
100
|
end
|
100
101
|
|
101
102
|
if error
|
@@ -109,12 +110,6 @@ class Chalk::Log::Layout < ::Logging::Layout
|
|
109
110
|
message
|
110
111
|
end
|
111
112
|
|
112
|
-
# Displaying info hash
|
113
|
-
|
114
|
-
def info!(message, info)
|
115
|
-
message << format_hash(info.merge(contextual_info || {}))
|
116
|
-
end
|
117
|
-
|
118
113
|
def display(key, value)
|
119
114
|
begin
|
120
115
|
value = json(value)
|
data/lib/chalk-log/version.rb
CHANGED
data/test/functional/log.rb
CHANGED
@@ -201,6 +201,13 @@ module Critic::Functional
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
+
it 'prefers explicit information over the context' do
|
205
|
+
log.with_contextual_info(omg: 'wtf') do
|
206
|
+
log.info("message", omg: 'ponies')
|
207
|
+
end
|
208
|
+
assert_logged("omg=ponies")
|
209
|
+
end
|
210
|
+
|
204
211
|
it 'requires a block' do
|
205
212
|
exn = assert_raises(ArgumentError) do
|
206
213
|
log.with_contextual_info(i_am_not: "passing a block")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chalk-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chalk-config
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.2.
|
160
|
+
rubygems_version: 2.2.2
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Chalk::Log makes any class loggable. It provides a logger that can be used
|
@@ -171,3 +171,4 @@ test_files:
|
|
171
171
|
- test/functional/log.rb
|
172
172
|
- test/unit/_lib.rb
|
173
173
|
- test/unit/chalk-log/utils.rb
|
174
|
+
has_rdoc:
|