Skip to content

Commit

Permalink
feat: reduce logger debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Oct 28, 2017
1 parent 161782e commit 0a6e293
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ export const query: InternalQueryType<*> = async (connection, rawSql, values) =>
const strippedSql = stripComments(rawSql);

log.debug({
sql: strippedSql,
values
sql: strippedSql
}, 'input query');

if (values) {
log.trace({
values
}, 'query variables');
}

try {
const start = process.hrtime();

Expand All @@ -92,12 +97,12 @@ export const query: InternalQueryType<*> = async (connection, rawSql, values) =>

const end = process.hrtime(start);

log.debug('query execution time %s', prettyHrtime(end));
log.trace('query execution time %s', prettyHrtime(end));

if (result.rowCount) {
log.debug('query returned %d row(s)', result.rowCount);
log.trace('query returned %d row(s)', result.rowCount);
} else if (Array.isArray(result)) {
log.debug('query returned %d row(s)', result.length);
log.trace('query returned %d row(s)', result.length);
}

return result;
Expand Down

0 comments on commit 0a6e293

Please sign in to comment.