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 🙏

© 2024 – Pkg Stats / Ryan Hefner

winston-beanstalkd

v0.1.4

Published

An Beanstalkd transport for winston

Downloads

7

Readme

winston-beanstalkd

A Beanstalkd transport for winston.

NPM version Dependency Status MIT License

Motivation

To enable a log-based work queue compatible with existing logging mechanisms.

Usage

  var winston = require('winston');
  
  //
  // Requiring `winston-beanstalkd` will expose 
  // `winston.transports.Beanstalkd`
  //
  require('winston-beanstalkd').Beanstalkd;
  
  winston.add(winston.transports.Beanstalkd, options);

The Beanstalkd transport takes the following options. 'host' is required:

  • silent: Boolean flag indicating whether to suppress output, defaults to false.
  • host: The host running Beanstalkd, defaults to localhost.
  • port: The port on the host that Beanstalkd is running on, defaults to
  • tube: The name of the tube you want to log to, defaults to 'winston.log'. See beanstalkd FAQ.
  • delay: See the beanstalkd FAQ.
  • priority: See the beanstalkd FAQ.
  • ttr: See the beanstalkd FAQ.
  • levelFilter: Whether to append the logging level to the tube name to filter on log level.
  • transformMessage: A custom function for transforming logged objects to a queue string, defaults to JSON.stringify().

Installation

Installing npm (node package manager)

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

Installing winston-beanstalkd

  $ npm install winston
  $ npm install winston-beanstalkd

Usage

See the examples for a logger and a watcher.

In one console, start the watcher:

  $ node examples/watch.js
Watching for logs on winston.log...

In another console, run the logger:

  $ node examples/logger.js
info:   Beanstalkd log event!
warn:   This is a warning!
error:  This is an error! code=505, anything=This is metadata
help:   Log number 0
help:   Log number 1
help:   Log number 2
help:   Log number 3
help:   Log number 4
log put to winston.log { level: 'info',
  text: '  Beanstalkd log event!',
  meta: undefined }
closing...
log put to winston.log { level: 'warn', text: '  This is a warning!', meta: undefined }
closing...
log put to winston.log { level: 'error',
  text: ' This is an error!',
  meta: { code: '505', anything: 'This is metadata' } }
closing...
log put to winston.log { level: 'help', text: '  Log number 0', meta: undefined }
closing...
log put to winston.log { level: 'help', text: '  Log number 1', meta: undefined }
closing...
log put to winston.log { level: 'help', text: '  Log number 2', meta: undefined }
closing...
log put to winston.log { level: 'help', text: '  Log number 3', meta: undefined }
closing...
log put to winston.log { level: 'help', text: '  Log number 4', meta: undefined }
closing...

Return to the watcher console and see the output from processing the log entries:

  $ node examples/watch.js
Watching for logs on winston.log...
received log: { id: '198',
  data: '{"level":"info","text":"  Beanstalkd log event!"}' }
processing log entry...
processed: true { id: '198',
  data: '{"level":"info","text":"  Beanstalkd log event!"}' }
deleted { id: '198',
  data: '{"level":"info","text":"  Beanstalkd log event!"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '199',
  data: '{"level":"warn","text":"  This is a warning!"}' }
processing log entry...
processed: true { id: '199',
  data: '{"level":"warn","text":"  This is a warning!"}' }
deleted { id: '199',
  data: '{"level":"warn","text":"  This is a warning!"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '200',
  data: '{"level":"error","text":" This is an error!","meta":{"code":"505","anything":"This is metadata"}}' }
processing log entry...
processed: true { id: '200',
  data: '{"level":"error","text":" This is an error!","meta":{"code":"505","anything":"This is metadata"}}' }
deleted { id: '200',
  data: '{"level":"error","text":" This is an error!","meta":{"code":"505","anything":"This is metadata"}}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '201', data: '{"level":"help","text":"  Log number 0"}' }
processing log entry...
processed: true { id: '201', data: '{"level":"help","text":"  Log number 0"}' }
deleted { id: '201', data: '{"level":"help","text":"  Log number 0"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '202', data: '{"level":"help","text":"  Log number 1"}' }
processing log entry...
processed: true { id: '202', data: '{"level":"help","text":"  Log number 1"}' }
deleted { id: '202', data: '{"level":"help","text":"  Log number 1"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '203', data: '{"level":"help","text":"  Log number 2"}' }
processing log entry...
processed: true { id: '203', data: '{"level":"help","text":"  Log number 2"}' }
deleted { id: '203', data: '{"level":"help","text":"  Log number 2"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '204', data: '{"level":"help","text":"  Log number 3"}' }
processing log entry...
processed: true { id: '204', data: '{"level":"help","text":"  Log number 3"}' }
deleted { id: '204', data: '{"level":"help","text":"  Log number 3"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
received log: { id: '205', data: '{"level":"help","text":"  Log number 4"}' }
processing log entry...
processed: true { id: '205', data: '{"level":"help","text":"  Log number 4"}' }
deleted { id: '205', data: '{"level":"help","text":"  Log number 4"}' }
[ 'DELETED' ]
Watching for logs on winston.log...
process callback
process callback
process callback
process callback
process callback
process callback
process callback
process callback

Author: Jason McInerney