Log objects rather than JSON strings and option for single line logs (#2028)
* Log objects rather than JSON strings and option for single line logs
This reverts commit fcd914bdfd.
* Better password stripping tests
This commit is contained in:
committed by
Florent Vilmart
parent
514095dc35
commit
7d234e054b
@@ -59,7 +59,10 @@ describe('verbose logs', () => {
|
||||
level: 'verbose'
|
||||
});
|
||||
}).then((results) => {
|
||||
expect(results[1].message.includes('"password": "********"')).toEqual(true);
|
||||
let logString = JSON.stringify(results);
|
||||
expect(logString.match(/\*\*\*\*\*\*\*\*/g).length).not.toBe(0);
|
||||
expect(logString.match(/moon-y/g)).toBe(null);
|
||||
|
||||
var headers = {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-REST-API-Key': 'rest'
|
||||
@@ -74,11 +77,16 @@ describe('verbose logs', () => {
|
||||
size: 100,
|
||||
level: 'verbose'
|
||||
}).then((results) => {
|
||||
expect(results[1].message.includes('password=********')).toEqual(true);
|
||||
let logString = JSON.stringify(results);
|
||||
expect(logString.match(/\*\*\*\*\*\*\*\*/g).length).not.toBe(0);
|
||||
expect(logString.match(/moon-y/g)).toBe(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
}).catch((err) => {
|
||||
fail(JSON.stringify(err));
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it("should not mask information in non _User class", (done) => {
|
||||
@@ -92,7 +100,7 @@ describe('verbose logs', () => {
|
||||
level: 'verbose'
|
||||
});
|
||||
}).then((results) => {
|
||||
expect(results[1].message.includes('"password": "pw"')).toEqual(true);
|
||||
expect(results[1].body.password).toEqual("pw");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user