mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 23:08:13 -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 ###
|
### @module omega-target/log ###
|
||||||
Log = require './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.
|
# Log is used as singleton.
|
||||||
# coffeelint: disable=missing_fat_arrows
|
# coffeelint: disable=missing_fat_arrows
|
||||||
module.exports = Log =
|
module.exports = Log =
|
||||||
@ -20,7 +28,7 @@ module.exports = Log =
|
|||||||
else if obj instanceof Error
|
else if obj instanceof Error
|
||||||
obj.stack || obj.message
|
obj.stack || obj.message
|
||||||
else
|
else
|
||||||
JSON.stringify(obj, null, 4)
|
JSON.stringify(obj, replacer, 4)
|
||||||
else if typeof obj == 'function'
|
else if typeof obj == 'function'
|
||||||
if obj.name
|
if obj.name
|
||||||
"<f: #{obj.name}>"
|
"<f: #{obj.name}>"
|
||||||
|
Loading…
Reference in New Issue
Block a user