winstonjs/abstract-winston-transport

Name: abstract-winston-transport

Owner: winstonjs

Description: A test suite and interface you can use to implement a Winston transport for various storage backends.

Created: 2015-03-17 21:38:51.0

Updated: 2017-11-15 02:49:45.0

Pushed: 2018-05-07 22:09:39.0

Homepage:

Size: 20

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Abstract Winston Transport

A set of mocha-based tests for ensuring that a given Transport (written for winston >= 3) is compatible with the expected APIs.

Inspired by https://github.com/maxogden/abstract-blob-store

Usage

test/your-transport.test.js

ire('abstract-winston-transport')({
me: 'YourTransport',
ansport: require('../path/to/your/transport')

Sample usage from winston/test/transports/console.test.js

ire('abstract-winston-transport')({
me: 'Console',
ansport: winston.transports.Console

Passing in custom options to your TransportStream

If your custom TransportStream requires more options on construction than a default TransportStream they can be provided via the construct option:

test/your-transport.test.js

ire('abstract-winston-transport')({
me: 'YourTransport',
ansport: require('../path/to/your/transport'),
nstruct: {
anyRequired: 'value-for-transport',
anythingReally: 'depends-on-what-you-need'


 "construct" can also be a function that returns
 options if that's something you need

nstruct: function () {
return {
  willBe: 'called-before'
  every: 'test'
};


Turning on additional query and stream test suites

There are additional suites for query and stream interfaces expected to be exposed on a winston Transport (i.e. a TransportStream). You can enable these by setting the options to true:

test/your-transport.test.js

ire('abstract-winston-transport')({
me: 'YourTransport',
ansport: require('../path/to/your/transport'),
ery: true,
ream: true

Author: Charlie Robbins LICENSE: MIT

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.