this module is a Winston implementation of the RDUK base logger provider
npm i --save --save-exact @rduk/logger @rduk/logger-winston-provider
# config.yml (see @rduk/configuration for detail)
---
logger:
default: winston
providers:
-
name: winston
type: '@rduk/logger-winston-provider'
level: debug
transports:
files:
-
filename: out.log
console: true
const logger = require('@rduk/logger');
logger.error('error');
logger.warn('warn');
logger.info('info');
logger.verbose('verbose');
logger.debug('debug');
By default, only the winston core transports are available (file
, console
, http
).
If you need another transport, you can create a factory.
const winston = require('winston');
require('winston-logstash');
module.exports = {
create: function(options) {
return [new winston.transports.Logstash(options)];
}
};
logger:
default: winston
providers:
-
name: winston
type: '@rduk/logger-winston-provider'
factories:
logstash: '~/path/to/factory'
level: info
transports:
logstash:
host: 'example.com'
port: 11111
node_name: myapp
See LICENSE file