g5-logger 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/g5/logger/log.rb +1 -1
- data/lib/g5/logger/version.rb +1 -1
- data/lib/g5/logger.rb +2 -1
- data/spec/g5/logger/log_spec.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa3b73b0b6d5dfb41c6b7f37aca0cd4ff1379ad
|
4
|
+
data.tar.gz: b5f982c46699a727d44616b0b71b6161a2d7c5f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38b4c22960ef7dd4f5a2d5d2cead866abf40e1dee54e313ecca30f4e9607005389d14879f616d0d65a91f5ad0703882b0fb40fb97b556cfdd084d4186c2a2d73
|
7
|
+
data.tar.gz: f8a129e1dfd6a9dd93519adb6e194fbb3f8b5b06bb03a2cbf54a66766819a6db85e3e1f725f47a8061d10064e1da23bbb8b350db02b15efce4f92cddcbea2122
|
data/lib/g5/logger/log.rb
CHANGED
@@ -11,7 +11,7 @@ module G5
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def log(attributes)
|
14
|
-
default_merge = {source_app_name: Config[:source_app_name]}.merge(attributes)
|
14
|
+
default_merge = {source_app_name: Config[:source_app_name]}.merge(Config[:default_log_hash]).merge(attributes)
|
15
15
|
log_level = level(default_merge.delete(:level))
|
16
16
|
Config[:logger].send(log_level, log_entry(default_merge))
|
17
17
|
end
|
data/lib/g5/logger/version.rb
CHANGED
data/lib/g5/logger.rb
CHANGED
@@ -12,7 +12,8 @@ module G5
|
|
12
12
|
source_app_name: 'REQUIRED - this is the name of the app using it',
|
13
13
|
format: JSON_FORMAT, # json or key_value
|
14
14
|
redact_keys: [/credit/, /password/, /cvv/],
|
15
|
-
redact_value: '***'
|
15
|
+
redact_value: '***',
|
16
|
+
default_log_hash: {} #when you Log.log(your_hash), your_hash will get merged into the default_log_hash
|
16
17
|
}
|
17
18
|
end
|
18
19
|
end
|
data/spec/g5/logger/log_spec.rb
CHANGED
@@ -6,19 +6,23 @@ describe G5::Logger::Log do
|
|
6
6
|
|
7
7
|
describe 'redact sensitive data' do
|
8
8
|
before do
|
9
|
+
G5::Logger::Config[:default_log_hash] = {external_parent_source_name: 'g5-jobs'}
|
9
10
|
G5::Logger::Config[:redact_keys] << 'redactme'
|
10
11
|
end
|
12
|
+
after do
|
13
|
+
G5::Logger::Config[:default_log_hash] = {}
|
14
|
+
end
|
11
15
|
let(:request) { {'credit_card' => '4344122144442222', foo: 'bar', parent: {cvv: '323', jimmy: 'joe'}, 'array' => [{'my_password' => 'jimpass', 'redactme' => 'secretval'}]} }
|
12
16
|
let(:body) { {credit_exp_date: '10/2015', whatever: 'brah'} }
|
13
17
|
let(:response) { double(:response, code: 201, body: body) }
|
14
|
-
let(:redact_value) {G5::Logger::Config[:redact_value]}
|
18
|
+
let(:redact_value) { G5::Logger::Config[:redact_value] }
|
15
19
|
|
16
20
|
subject do
|
17
21
|
G5::Logger::Log.log_json_req_resp(request, response, {foo: 'bar', 'j_cvv' => 343})
|
18
22
|
indifferent_hash_from_json TestLogger.last_payload
|
19
23
|
end
|
20
24
|
|
21
|
-
it { is_expected.to eq({"source_app_name" => "test", "foo" => "bar", "j_cvv" => redact_value, "status" => 201,
|
25
|
+
it { is_expected.to eq({"source_app_name" => "test", "external_parent_source_name" => "g5-jobs", "foo" => "bar", "j_cvv" => redact_value, "status" => 201,
|
22
26
|
"request" => {"credit_card" => redact_value, "foo" => "bar",
|
23
27
|
"parent" => {"cvv" => redact_value, "jimmy" => "joe"},
|
24
28
|
"array" => [{"my_password" => redact_value, "redactme" => redact_value}]},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perry Hertler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|