Miss any of our Open RFC calls?Watch the recordings here! »

winston-transport-sequelize

4.0.4 • Public • Published

winston-transport-sequelize

Sequelize transport for winston

Install

npm install winston-transport-sequelize

Example

const winston = require('winston');
const WinstonTransportSequelize = require('winston-transport-sequelize');
const Sequelize = require('sequelize');
const sequelize = new Sequelize();
 
const options = {
  sequelize: sequelize, // sequelize instance [required]
  tableName: 'WinstonLog', // default name
  meta: { project: 'myProject' }, // meta object defaults
  fields: { meta: Sequelize.JSONB }, // merge model fields
  modelOptions: { timestamps: false }, // merge model options
}
 
const logger = new winston.Logger({
  transports: [
    new WinstonTransportSequelize(options)
  ]
});

Sequelize model is created after sequelize.sync()

You can find the model in transport.model

More

This transport has own method .clean([lifetime], [callback])

You can clean the old data via this.clean(ms), filtering by "updateAt" field.

Install

npm i winston-transport-sequelize

DownloadsWeekly Downloads

187

Version

4.0.4

License

MIT

Unpacked Size

7.6 kB

Total Files

6

Last publish

Collaborators

  • avatar