mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Remove values for a few keys from exported log for privacy. Fix #1147.
This commit is contained in:
parent
7bc8655421
commit
32cb2f909e
@ -1,6 +1,14 @@
|
||||
### @module omega-target/log ###
|
||||
Log = require './log'
|
||||
|
||||
replacer = (key, value) =>
|
||||
switch key
|
||||
# Hide values for a few keys with privacy concerns.
|
||||
when "username", "password", "host", "port"
|
||||
return "<secret>"
|
||||
else
|
||||
value
|
||||
|
||||
# Log is used as singleton.
|
||||
# coffeelint: disable=missing_fat_arrows
|
||||
module.exports = Log =
|
||||
@ -20,7 +28,7 @@ module.exports = Log =
|
||||
else if obj instanceof Error
|
||||
obj.stack || obj.message
|
||||
else
|
||||
JSON.stringify(obj, null, 4)
|
||||
JSON.stringify(obj, replacer, 4)
|
||||
else if typeof obj == 'function'
|
||||
if obj.name
|
||||
"<f: #{obj.name}>"
|
||||
|
Loading…
Reference in New Issue
Block a user