winston-transport-http-stream

0.1.4 • Public • Published

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')

Package Sidebar

Install

npm i winston-transport-http-stream

Weekly Downloads

1,445

Version

0.1.4

License

MIT

Unpacked Size

181 kB

Total Files

8

Last publish

Collaborators

  • matsp