Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-array-transport

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-array-transport

write logs to js Array

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
decreased by-79.01%
Maintainers
1
Weekly downloads
 
Created
Source

winston-array-transport

write winston logs directly to javascript Array.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Total alerts Language grade Scrutinizer

Dependencies Vulnerabilities Build Status Coverage Status

Commit activity License

Table of Contents

Motivation

There are a lot of cases where you need to parse and analyze your logs. For example, to access them during tests. This package provides transport that allows simply push logs to js array, so you don't need any runtime parsers anymore.

Requirements

To use library you need to have node and npm installed in your machine:

  • node 6.0+
  • npm 3.0+

Installation

To install the library run the following command

  npm i --save winston-array-transport

Usage

The package can be used alongside any other winston transport.

import ArrayTransport from 'winston-array-transport';
import { createLogger } from 'winston';

const logs = [];
const transport  = new ArrayTransport({ array: logs, json: true, level: 'info' });

export const logger = createLogger({
    transports : [ transport ]
});

Configuration

Next options can be configured while transport creation:

  • name - name of a transport, ArrayTransport by default;
  • eol - end of line , os.EOL by default;
  • array - array, where all logs will be stored;
  • parser - function, that will be applied to log messages;
  • json - if set to true, JSON.parse parser will be used;
  • limit - allows to limit amount of logs to n last items;

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions.

Commit message summaries must follow this basic format:

  Tag: Message (fixes #1234)

The Tag is one of the following:

  • Fix - for a bug fix.
  • Update - for a backwards-compatible enhancement.
  • Breaking - for a backwards-incompatible enhancement.
  • Docs - changes to documentation only.
  • Build - changes to build process only.
  • New - implemented a new feature.
  • Upgrade - for a dependency upgrade.
  • Chore - for tests, refactor, style, etc.

The message summary should be a one-sentence description of the change. The issue number should be mentioned at the end.

Keywords

FAQs

Package last updated on 05 May 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc