Skip to content

Commit

Permalink
Merge branch 'master' into feature/json-redact
Browse files Browse the repository at this point in the history
  • Loading branch information
tmwllc committed Sep 13, 2018
2 parents ee31d20 + bcf78b2 commit 4830119
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,3 @@ export default class Encoder {
return internalSwap(obj)
}
}
0
28 changes: 0 additions & 28 deletions test/encoder.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,6 @@ describe('encoder', () => {
)
})

it('should redact values from JSON string and convert JSON to object', () => {
let encoded = new Encoder({redactList: [new RegExp('(\blng\b)|(\blat\b)|firstName|lastName|phone', 'gi')]}).encode({
traceId: 'abc',
spanId: 'def',
parentId: 'ghi',
operation: 'op1',
start: 1489522409134,
duration: 123,
tags: {
redact: 'val1',
tag2: 'val2'
},
logs: [{
firstName: 'Tom',
event:"Handled Request",
level:"info",
message:"Handled Request POST:/v2/reservations/8FC5735C312A44A1933365EDECFCA36D-1518675144764[461]",
logEvent:"Handled Request",
request: {
headers: {},
body:"{\"status\":\"active\",\"shopper\":{\"firstName\":\"Tom\",\"lastName\":\"Wallace\",\"phone\":\"1234567891\"}}"
}
}]
})
encoded.should.equal('{"traceId":"abc","spanId":"def","parentId":"ghi","operation":"op1","start":1489522409134,"duration":123,"tags":{"redact":"val1","tag2":"val2"},"logs":[{"firstName":"***","event":"Handled Request","level":"info","message":"Handled Request POST:/v2/reservations/8FC5735C312A44A1933365EDECFCA36D-1518675144764[461]","logEvent":"Handled Request","request":{"headers":{},"body":{"status":"active","shopper":{"firstName":"***","lastName":"***","phone":"***"}}}}]}' + os.EOL
)
})

it('should redact values', () => {
let encoded = new Encoder({redactList: [/redact/]}).encode({
traceId: 'abc',
Expand Down

0 comments on commit 4830119

Please sign in to comment.