npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@geekygeeky/winston-redis

v1.0.1

Published

A logger library that integrates Winston with Redis for centralized logging

Readme

Winston Redis Logger

A flexible and easy-to-use Winston logger transport that integrates with Redis for centralized logging. This package allows you to log to Redis, the console, or any other transport, with full TypeScript support.


Features

  • Winston Logger Integration: Uses the popular Winston logger.
  • Redis Transport: Logs can be pushed to a Redis list for centralized storage and retrieval.
  • Flexible Configuration: Easily toggle Redis transport and configure logging levels.
  • TypeScript Support: Fully typed with TypeScript for easy development.

Installation

You can install the package via npm or yarn:

npm install @geekygeeky/winston-redis

Or with Yarn:

yarn add @geekygeeky/winston-redis

Usage

Basic Usage with Redis Transport

import { RedisLogger } from '@geekygeeky/winston-redis';

const redisLogger = new RedisLogger({
  redisEnabled: true,                       // Enable Redis transport
  redisOptions: { host: 'localhost', port: 6379 }, // Redis connection settings
  redisKey: 'logs:errors',                  // Redis list to store logs
  level: 'info',                             // Minimum logging level
});

const logger = redisLogger.getLoggerInstance()

logger.info('User logged in', { userId: 12345 });
logger.error('Error occurred', { error: 'Something went wrong' });

Without Redis (Console Only)

import { RedisLogger } from '@geekygeeky/winston-redis';

const logger = new RedisLogger({
  redisEnabled: false,  // Disable Redis transport (only console will be used)
  level: 'debug',       // Set the logging level
}).getLoggerInstance();

logger.debug('Debugging information', { debugInfo: 'extra details' });

Accessing the Redis Instance

If you need to perform advanced Redis operations or monitor the Redis connection directly, you can access the Redis instance:


const redis = redisLogger.getRedisTransport()?.getRedisInstance();

if (redis) {
  redis.on('error', (err) => {
    console.error('Redis error:', err);
  });

  // Perform custom Redis operations
  redis.set('key', 'value');
}

Accessing the Internal Winston Logger

If you need to access the underlying Winston logger instance directly, you can do so:

const winstonLogger = redisLogger.getLoggerInstance();
winstonLogger.info('This is a direct Winston log', { additionalData: 'info' });

API

Logger Options

  • redisEnabled (default: false): Whether to enable Redis transport or not.
  • redisOptions: The options passed to the Redis client (see ioredis documentation).
  • redisKey (default: 'logs:errors'): The Redis list key where logs will be stored.
  • level (default: 'info'): The minimum level of logging to log.

Logger Methods

  • log(level: string, message: string, meta?: object): Log a message at a specified level with optional metadata.
  • getLoggerInstance(): Gives you access Winston logger instance.
    • debug(message: string, meta?: object): Log a debug message.
    • info(message: string, meta?: object): Log an info message.
    • warn(message: string, meta?: object): Log a warning message.
    • error(message: string, meta?: object): Log an error message.

RedisTransport Methods

  • getRedisInstance(): Access the underlying Redis instance for advanced operations.
  • getRedisTransport(): Get the Redis transport instance, if enabled.

Testing

Run Tests

We use Mocha and Chai for testing. To run tests, simply execute:

npm test

Contributing

We welcome contributions to improve this package! Please follow the steps below:

  1. Fork the repository and clone it to your local machine.
  2. Create a new branch for your changes (git checkout -b feature/my-feature).
  3. Make your changes and commit them with descriptive messages.
  4. Run tests to ensure everything works correctly (npm test).
  5. Push your changes to your fork and create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

Olushola O. (GeekyGeeky)