是否可以使用 Node mysql / mysql2 库查看完整的编译查询?

Is it possible to see full compiled query with Node mysql / mysql2 libraries?

例如我有这样的代码:

conn.query('INSERT INTO events_log SET ?', [record]);

如果有错误,图书馆只是自己显示错误,而不是图书馆提出的查询。可以看到吗?

P.S。我的意思是查询应该类似于 INSERT INTO events_log SET name = 'va\'lue' 并且没有此查询的默认错误示例是:

Error: Data too long for column 'ip' at row 1
    at PromiseConnection.query (/Users/node_modules/mysql2/promise.js:92:22)
    at /Users/server.js:195:9
    at processTicksAndRejections (node:internal/process/task_queues:93:5) {
  code: 'ER_DATA_TOO_LONG',
  errno: 1406,
  sqlState: '22001',
  sqlMessage: "Data too long for column 'ip' at row 1"
}

debug: true 添加到 createConnectioncreatePool 将显示组合的查询:

mysql.createConnection({debug: true});