winston-transport-sequelize

4.0.10 • 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.

Package Sidebar

Install

npm i winston-transport-sequelize

Weekly Downloads

70

Version

4.0.10

License

MIT

Unpacked Size

7.6 kB

Total Files

6

Last publish

Collaborators

  • ortex