Socket
Socket
Sign inDemoInstall

@codibre/winston-redis

Package Overview
Dependencies
36
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @codibre/winston-redis

A fixed-length Redis transport for winston


Version published
Weekly downloads
421
increased by23.1%
Maintainers
8
Install size
2.70 MB
Created
Weekly downloads
 

Readme

Source

winston-redis

A capped Redis transport for winston.

Requirements

  • NodeJS 8.11.x
  • Winston 3.x

Usage

  const winston = require('winston');
  const redisTransport = require('winston-redis');

  const logger = winston.createLogger({
    level: 'info',
    transports: [
      new redisTransport()
    ]
  });

  logger.log({
    level: "info",
    message: "redis is awesome",
    reason: "it's fast" // this will get stored as meta data
  });

This transport accepts the options accepted by the node-redis client:

  • host: (Default localhost) Remote host of the Redis server
  • port: (Default 6379) Port the Redis server is running on.
  • auth: (Default None) Password set on the Redis server

In addition to these, the Redis transport also accepts the following options.

  • redis: Either the redis client or the options for the redis client
  • length: (Default 200) Number of log messages to store.
  • container: (Default winston) Name of the Redis container you wish your logs to be in.
  • channel: (Default None) Name of the Redis channel to stream logs from.
  • meta: (Default {}) Custom fields to add to each log.
  • flatMeta: (Default false) Store meta data at the top level of the object rather than within a child meta object.

Metadata: Logged as JSON literal in Redis

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing winston-redis

  $ npm install winston
  $ npm install winston-redis

Run Tests

Winston-redis tests are written in mocha, using Abstract Winston Transport and designed to be run with npm.

  npm test
Author: Charlie Robbins

Keywords

FAQs

Last updated on 16 Dec 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc