Registry / database / winston-mysql-transport

winston-mysql-transport

JSON →
library0.1.2jsnpmunverified

A MySQL transport for the winston logging library, allowing log entries to be stored in a MySQL database table. Version 0.1.2 is current; the package appears unmaintained (last commit 2015). It integrates with winston by exposing a transport that writes logs to a specified table. It does not support streaming, querying, or storing metadata. Relies on the mysql npm package. No recent updates or security patches.

npm install winston-mysql-transport
INSTALL
IMPORT
SIG · WINSTON-MYSQL-TRAN
W
winston-mysql-transport
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

winston-mysql-transport
require('winston-mysql-transport').Mysql
const Mysql = require('winston-mysql-transport')
You must access .Mysql property; default export is not the transport.
winston.transports.Mysql
const winston = require('winston'); require('winston-mysql-transport').Mysql; winston.add(winston.transports.Mysql, options)
winston.add(winston.transports.Mysql, options) before requiring the transport
The transport is registered globally on winston.transports when required.
Mysql
const Mysql = require('winston-mysql-transport').Mysql; const transport = new Mysql(options)
const transport = new require('winston-mysql-transport')(options)
Only CommonJS supported; no ESM or TypeScript types.

Shows how to add the MySQL transport to winston and log a message.

// Ensure winston is installed: npm install winston const winston = require('winston'); require('winston-mysql-transport').Mysql; const options = { database: 'my_database', table: 'log_table', user: 'root', password: process.env.DB_PASSWORD || '' }; winston.add(winston.transports.Mysql, options); winston.log('info', 'Hello MySQL log!');
Debug
Known issues
deprecatedPackage is unmaintained and likely does not work with modern winston (v3+).
fix
Use a maintained alternative like winston-daily-rotate-file or winston-postgresql.
affects: >=0.1.2
gotchaMetadata is not saved; only level, message, timestamp, and hostname are stored.
fix
Customize the transport or use a different transport that supports meta.
affects: >=0.0.0
gotchaRequires the mysql npm package (native).
fix
Install mysql: npm install mysql
affects: >=0.0.0
breakingThe transport uses the deprecated winston 2.x transport API.
fix
Migrate to winston 3.x custom transport or use compat layer.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'winston-mysql-transport'
Package not installed or import path wrong.
fix
Run npm install winston-mysql-transport
TypeError: winston.transports.Mysql is not a constructor
The transport was not required properly or is not registered.
fix
Ensure require('winston-mysql-transport').Mysql is called before using winston.transports.Mysql.
Error: ER_BAD_DB_ERROR: Unknown database 'my_database'
Database specified in options does not exist.
fix
Create the database or change the database option to an existing one.
Warning: possible EventEmitter memory leak detected. 11 listeners added
Multiple transport instances causing listener accumulation.
fix
Use a single transport instance or set maxListeners.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
winstonrequiredPeer dependency; transport requires winston to function.
Agent activity
23 hits · last 30 days
node
18
Meta
2
OpenAI (training)
1
Resources
winston-mysql-transport — npm install winston-mysql-transport · libregistry