Skip to content

WHASQ/rduk-logger-winston-provider

 
 

Repository files navigation

RDUK - Winston logger provider

Build Status Coverage Status Greenkeeper badge JavaScript Style Guide

this module is a Winston implementation of the RDUK base logger provider

Installation

npm i --save --save-exact @rduk/logger @rduk/logger-winston-provider

Configuration

# 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

Usage

const logger = require('@rduk/logger');
logger.error('error'); 
logger.warn('warn'); 
logger.info('info'); 
logger.verbose('verbose'); 
logger.debug('debug'); 

Transports

By default, only the winston core transports are available (file, console, http).

If you need another transport, you can create a factory.

Example (winston logstash)

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

License and copyright

See LICENSE file

About

Winston Provider implementation for rduk-logger

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%