jshint
This commit is contained in:
parent
c53ed67252
commit
25e54dc267
@ -9,7 +9,7 @@ module.exports = function log() {
|
||||
request: {
|
||||
sql: prepareSQL(res.locals.sql)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
res.set('X-SQLAPI-Log', stringifyForLogs(logObj, MAX_SQL_LENGTH));
|
||||
|
||||
@ -25,16 +25,16 @@ function prepareSQL(sql) {
|
||||
if (typeof sql === 'string') {
|
||||
return {
|
||||
simple: sql.substring(0, MAX_SQL_LENGTH)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (Array.isArray(sql)) {
|
||||
return {
|
||||
multiple: sql.map(q => q.substring(0, MAX_SQL_LENGTH))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
other: sql
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ module.exports = {
|
||||
stringifyForLogs(object, max_string_length = 1024) {
|
||||
return JSON.stringify(cloneAndFilter(object, max_string_length));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function cloneAndFilter(object, max_string_length) {
|
||||
if (!object || !(object instanceof Object)) {
|
||||
@ -22,7 +22,7 @@ function cloneAndFilter(object, max_string_length) {
|
||||
|
||||
Object.keys(object).map(key => {
|
||||
if (typeof object[key] === 'string') {
|
||||
newObject[key] = filterString(object[key], max_string_length)
|
||||
newObject[key] = filterString(object[key], max_string_length);
|
||||
} else if (typeof object[key] === 'object') {
|
||||
newObject[key] = cloneAndFilter(object[key], max_string_length);
|
||||
} else if (object[key] instanceof Array) {
|
||||
|
Loading…
Reference in New Issue
Block a user