winston-transport-sequelize

    4.0.9 • 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

    225

    Version

    4.0.9

    License

    MIT

    Unpacked Size

    7.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • ortex