MySqlLogger

MySqlLogger

new MySqlLogger()

Logs the start and completion or error of a MySql database command

Source:

Methods

(static) emitQuery(logger, connection, sql, params) → {object}

Creates a 'begin' log entry. The SQL statement and params are logged. Returns the value returned by the older mysql package's (instead of the mysql2 package) connection.query method for stream-based data access.

Source:
Parameters:
Name Type Description
logger object
connection object

A mysql2 Connection object

sql string

A SQL statement to execute

params *

Placeholder arguments for the sql statement

Returns:
Type:
object

Returns an object with two properties: emitter: The return value of conection.connection.query(). It has on() methods. logger: The return value of GeneratorLogger.begin() with the following additional properties:

  1. {String} sql
  2. {*[]} params
  3. {String} summary: A summarized version of the sql argument See GeneratorLogger.begin() for more information.

(static) query(logger, connection, sql, params) → {Promise}

Creates two log entries for a Connection.query() execution: 'begin' and either 'end' or 'error.' See TaskLogger.execute for more information. The sql and params arguments are logged.

Source:
Parameters:
Name Type Description
logger object
connection Connection

mysql2 Connection object

sql string

SQL statement to execute

params *

SQL statement placeholder arguments

Returns:
Type:
Promise

Returns the return value of connection.query(sql, params)