Skip to content

fsalehpour/winston-ioredis-transport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winston-ioredis-transport

NPM

GitHub issues GitHub forks GitHub stars NPM Twitter Twitter Follow

A transport to use with winston logging library to publish logs on a pubsub channel on Redis.

There are other transports available for Redis, this one uses ioredis. So, if you already have it as a dependency in your project you won't need to introduce another redis package just to log.

Install

npm install winston-ioredis-transport

Example

JavaScript:

const Redis = require('ioredis');
const winston = require('winston');
const {WinstonIORedisTransport} = require('winston-ioredis-transport');

let redis = new Redis();
let logger = winston.createLogger({
    transports: [
        new WinstonIORedisTransport({redis, channel: 'logs'})
    ]
});

logger.info('my new message', {abc: 123, ts: new Date(), colour: "purple"});

TypeScript:

import Redis from 'ioredis';
import winston from 'winston';
import {WinstonIORedisTransport} from 'winston-ioredis-transport';

let redis = new Redis();
let logger = winston.createLogger({
    transports: [
        new WinstonIORedisTransport({redis, channel: 'logs'})
    ]
});

logger.info('my new message', {abc: 123, ts: new Date(), colour: "purple"});

Run Tests

The tests are written in Gherkin with cucumber and Sinon.js

npm test

Author: Faramarz Salehpour

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published