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-rethinkdb

v1.0.0

Published

A RethinkDB transport for winston

Downloads

4

Readme

winston-rethinkdb

A RethinkDB transport for winston.

Uses rethinkdbdash for it's client driver, and supports querying and streaming.

Usage

  var winston = require('winston')

  // Requiring 'winston-rethinkdb' will expose `winston.transports.RethinkDB`
  require('winston-rethinkdb').RethinkDB

  winston.add(winston.transports.RethinkDB, options)

The RethinkDB transport takes the following options:

  • name: Transport instance identifier when creating multiple RethinkDB transports. Optional, defaults to 'rethinkdb'.
  • level: Level of messages that should be recorded. Optional, defaults to 'info'.
  • label: Label to add to log records. Optional.
  • silent: Set to true to suppress recording of log messages.
  • storeHost: Set to true to add os.hostname() to log records.
  • db: Name of database to use for saving logs. Optional, defaults to 'test'.
  • table: Name of table to use for saving logs. Optional, defaults to 'log'.
  • options: rethinkdbdash options or function that returns pre-configured reql.

Connecting

If options.options is an object, it is passed directly to rethinkdbdash or nothing is passed (connecting to localhost:28015) if options.options is undefined.

A function can be passed instead of an object, it will be called and expects a ReQL term object to be returned.

  options.options = {
    servers: [
        {host: '192.168.0.100', port: 28015},
        {host: '192.168.0.101', port: 28015},
        {host: '192.168.0.102', port: 28015},
    ],
    buffer: 300,
    max: 3000
  }

  winston.add(winston.transports.RethinkDB, options)

Could also be written as follows, if you intend to use r for other modules (ie. session-rethinkdb) or just elsewhere in your application to avoid multiple connection pool configurations.

  var r = require('rethinkdb')({
    servers: [
        {host: '192.168.0.100', port: 28015},
        {host: '192.168.0.101', port: 28015},
        {host: '192.168.0.102', port: 28015},
    ],
    buffer: 300,
    max: 3000
  })

  options.options = function () { return r }

  winston.add(winston.transports.RethinkDB, options)

unit test plan

I have not had a chance to write automated tests, but have identified the following test cases that I intend to get tests written for soon.

  • constructor options
  • initialization when db and table exist
  • initialization when db exists, table does not
  • initialization when neither db nor table exist
  • queue log attempts until transport is ready
  • circular references in meta data when logging
  • too deeply nested meta data
  • connection pool connectivity issues
  • query loggly options
  • query attempts before transport is ready
  • stream attempts before transport is ready
  • stream options
  • stream disconnection
  • attempting log, query or stream after closed