fix(loggable): removed private properties from logs
This commit is contained in:
parent
9fac23038f
commit
67985077e7
|
@ -291,7 +291,8 @@ module.exports = function(Self) {
|
|||
* @param {*} properties Modified object properties
|
||||
*/
|
||||
function removeUnloggable(definition, properties) {
|
||||
const propList = Object.keys(properties);
|
||||
const objectCopy = Object.assign({}, properties);
|
||||
const propList = Object.keys(objectCopy);
|
||||
const propDefs = new Map();
|
||||
|
||||
for (let property in definition.properties) {
|
||||
|
@ -302,10 +303,15 @@ module.exports = function(Self) {
|
|||
|
||||
for (let property of propList) {
|
||||
const propertyDef = propDefs.get(property);
|
||||
const firstChar = property.substring(0, 1);
|
||||
const isPrivate = firstChar == '$';
|
||||
|
||||
if (!propertyDef) return;
|
||||
if (isPrivate || !propertyDef)
|
||||
delete properties[property];
|
||||
|
||||
if (propertyDef.log === false)
|
||||
if (!propertyDef) continue;
|
||||
|
||||
if (propertyDef.log === false || isPrivate)
|
||||
delete properties[property];
|
||||
else if (propertyDef.logValue === false)
|
||||
properties[property] = null;
|
||||
|
|
Loading…
Reference in New Issue