accept multiple values types in queries log
This commit is contained in:
parent
feb3a21dfd
commit
9e25cc9501
@ -17,5 +17,24 @@ module.exports = function log() {
|
||||
};
|
||||
|
||||
function prepareSQL(sql) {
|
||||
return (sql && sql.substring(0, MAX_SQL_LENGTH)) || null;
|
||||
if (!sql) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user