0.1.4 • Published 5 years ago

winston-transport-http-stream v0.1.4

Weekly downloads
250
License
MIT
Repository
github
Last release
5 years ago

winston-transport-http-stream

npm npm

npm version Build Status Greenkeeper badge

This library will push your Winston logger information to an external http endpoint e.g. central log collection. When the request fails the logging request won't be send again.

Installation

npm install winston-transport-http-stream

or

yarn add winston-transport-http-stream

Usage

Example

The options parameter object is directly passed to node's http library but you can add also the url property that will be parsed and automatically set the relevant options for http. You can see all options in the official docs here.

const winston = require('winston')
const HttpStreamTransport = require('winston-transport-http-stream')

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' }),
    new HttpStreamTransport({
      url: 'https://yourdomain.com/log'
    })
  ]
})

logger.info('hello')
0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.0.2

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago