Skip to content

Application level slow log for mysql connections. Good for debugging slow queries when you haven't turned on or have access to the database slow log.

License

Notifications You must be signed in to change notification settings

olahol/node-mysql-slowlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-mysql-slowlog

Application level slow log for mysql connections. Good for debugging slow queries when you haven't turned on or have access to the database slow log.

Install

$ npm i mysql-slowlog --save

Example

var conn = require("mysql").createConnection({
  ...
});

// This patches the conn.query method to record time diffs.
var log = require("mysql-slowlog")(conn, {
  time: 5000 // Five seconds is pretty slow.
});

log.on("slow", function (time, query) {
  console.log("query %s took %dms", query, time);
});

Changelog

v0.1.2

  • Added error stack from where the query was called. This can be used to locate where in your code the query was called.

v0.1.1

  • Fix bug when there is no stream returned by query.

About

Application level slow log for mysql connections. Good for debugging slow queries when you haven't turned on or have access to the database slow log.

Resources

License

Stars

Watchers

Forks

Packages

No packages published