diff --git a/app/middlewares/log.js b/app/middlewares/log.js index c198b44c..baf33e36 100644 --- a/app/middlewares/log.js +++ b/app/middlewares/log.js @@ -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 + } + }