🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More
Socket
Sign inDemoInstall
Socket

winston-transport-http-stream

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-transport-http-stream

custom winston transport to stream logs to http endpoint

0.1.4
latest
Source
npm
Version published
Maintainers
1
Created
Source

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

Keywords

winston

FAQs

Package last updated on 10 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts