3.1.5 • Published 3 years ago

winston-callback v3.1.5

Weekly downloads
29
License
MIT
Repository
github
Last release
3 years ago

Install

npm install winston winston-callback

About

It allows you to call a handler after the completion of all transports. You must install winston by yourself. It is a peer dependency.

Example

const winston = require('winston-callback');
/* 
  or: 
  require('winston-callback');
  const winston = require('winston');  
*/

const options = {
  transports: [
    new (winston.transports.Console)({
        level: 'info',
        colorize: true
    }),
    new (winston.transports.File)({
        name: 'f1'
        filename: "logs/error.log",
        level: 'error'
    }),
    new (winston.transports.File)({
        name: 'f2'
        filename: "logs/info.log",
        level: 'info'
    })
    //... other transports
  ]
}

const logger = winston.createLogger
  ? winston.createLogger(options) // for v3
  : new (winston.Logger)(options); // for v2 

logger.error('a callback handling', function (err) {
  process.exit();
});

logger.info('a promise handling').finally(function () {
  process.exit();
});
3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.0

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

7 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago