How to use the logform.Format function in logform

To help you get started, we’ve selected a few logform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / express-winston / express-winston-tests.ts View on Github external
new winston.transports.Console({})
  ],
}));

const logger = winston.createLogger();

// Logger with minimum options (winstonInstance)
app.use(expressWinston.logger({
  winstonInstance: logger,
}));

// Error Logger with all options
app.use(expressWinston.errorLogger({
  baseMeta: { foo: 'foo', nested: { bar: 'baz' } },
  dynamicMeta: (req, res, err) => ({ foo: 'bar' }),
  format: new Format(),
  level: (req, res) => 'level',
  metaField: 'metaField',
  msg: 'msg',
  requestFilter: (req, prop) => true,
  requestWhitelist: ['foo', 'bar'],
  transports: [
    new winston.transports.Console({})
  ]
}));

// Error Logger with min options (transports)
app.use(expressWinston.errorLogger({
  transports: [
    new winston.transports.Console({})
  ],
}));

logform

An mutable object-based log format designed for chaining & objectMode streams.

MIT
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis