DbCallTracker - do-/node-doix-db GitHub Wiki

DbCallTracker is a LifeCycleTracker descendant for tracking and logging DbCall's lifecycle.

It's the default for DbPool's trackerClass. Application developers may replace it by another similar class but should never need to instantiate it directly.

Basically, it's a SQL + parameters formatter for log files.

Global functions

stringifyParams (p)

For an empty array, returns an empty string.

For an non-empty array, returns a string [${p1}, ${p2}, ... ${pn}] where each ${pk} is a SQL literal corresponding to the kth element of p: numbers and booleans are just converted to string, strings are quoted, with unsafe characters escaped.

Otherwise (for non-array objects), falls back to JSON.stringify().

Methods

startMessage ()

Returns {level: 'info', message: prefix + '${normalizeSpace (sql)} [${stringifyParams (params)}]'}. The sql's whitespace is normalized.

See also finishMessage () and errorMessage () in the parent class.