Closed phiresky closed 7 years ago
I think something like this should be the default
const debugSql = require('debug')('typed-sql'); const qs: QueryService; qs.onSqlStatement.sub((self, args) => { if (debugSql.enabled) debugSql(args.sql.substr(0, 400), args.sql.length > 400 ? "..." : "", args.parameters.slice(0, 20), args.parameters.length > 20 ? "..." : ""); });
Then you can debug the SQL statements generated by simly running the process using
DEBUG=typed-sql node script.js
Implemented with this code:
log("Executing SQL query '%s' with args %o", queryText, parameters);
I don't shorten the sql query here as this could be done using a debug formatter.
What is a "debug formatter"
See https://github.com/visionmedia/debug#formatters
I think something like this should be the default
Then you can debug the SQL statements generated by simly running the process using
DEBUG=typed-sql node script.js