Skip to content

Commit 5392891

Browse files
committed
feat: hide username and password in the log output
1 parent dd8f858 commit 5392891

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/utils/tracer-logger.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ const logger = tracer.colorConsole({
1515
dateformat: 'HH:MM:ss.L',
1616
preprocess: function (data) {
1717
data.title = data.title.toUpperCase();
18+
if (data.args.length > 1) {
19+
// have more than only just a string passed to the logger
20+
for (const [key, value] of Object.entries(data.args)) {
21+
if (typeof(value) === 'object'){
22+
if ('immobilienScout24' in value) {
23+
// found something that looks like a configuration
24+
// we don't want to modify the object, so we copy it
25+
// do not feed back name and password
26+
let { immobilienScout24, ...other } = value;
27+
data.args[key] = Object.assign({}, other);
28+
let { userName, password, ...other24} = immobilienScout24;
29+
data.args[key].immobilienScout24 = Object.assign({}, other24);
30+
}
31+
}
32+
}
33+
}
1834
},
1935
filters: {
2036
log: colors.magenta,

0 commit comments

Comments
 (0)