Bloody enterprise logger tools.
Which logger to choose? Any. Because it doesn't matter at all. Just look at the problem from a different perspective. Logging is stateful data processing — pipeline of formatters, translators that ends in persistent storage. Really significant things:
- Context detailing
- Tracing (MDC)
- Sensitive data masking
yarn add @qiwi/logwrap
npm i @qiwi/logwrap
// logger.js
import {Logwrap, masker as maskerFactory, mdc as mdcFactory} from '@qiwi/logwrap'
import winston from 'winston'
import DailyRotateFile from 'winston-daily-rotate-file'
const { createLogger, transports: {Console}, config: {colorize}} = winston
winston.transports.DailyRotateFile = DailyRotateFile
const mdc = mdcFactory()
const masker = maskerFactory()
const logger = createLogger()
logger.configure({...})
const logwrap = new Logwrap({
pipeline: [mdc, masker, logger],
level: 'DEBUG'
})
export default logwrap