1.0.1 • Published 9 years ago

bunyan-redis-stream v1.0.1

Weekly downloads
150
License
MIT
Repository
github
Last release
9 years ago

bunyan-redis-stream

Build Status

A lightweight Redis stream for Bunyan that can publish to a channel or push to a list.

Installation

npm install bunyan-redis-stream

Usage

node_redis

var bunyan = require('bunyan'),
    redis = require('redis'),
    RedisStream = require('bunyan-redis-stream'),
    client = redis.createClient();

var stream = new RedisStream({
  client : client,
  key    : 'logs',
  type   : 'channel'
});

var logger = bunyan.createLogger({
  name: 'bunyan-redis-stream',
  streams: [{
    type   : 'raw',
    level  : 'trace',
    stream : stream
  }]
});

ioredis

var bunyan = require('bunyan'),
    Redis = require('ioredis'),
    RedisStream = require('bunyan-redis-stream'),
    client = new Redis();

var stream = new RedisStream({
  client : client,
  key    : 'logs',
  type   : 'channel'
});

var logger = bunyan.createLogger({
  name: 'bunyan-redis-stream',
  streams: [{
    type   : 'raw',
    level  : 'trace',
    stream : stream
  }]
});

Params

NameTypeDescription
clientobjectRedis client instance
key=logsstringName of Redis list or channel to use
type=channelstringMethod used in which to store log messages in Redis. Either list or channel.

Running Tests

General

npm test

Integration

Integration tests assume that a Redis server is running locally on port 6379 with no auth.

npm run integration