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

@openagenda/logs

v1.1.10

Published

This logger lib adds some functionality to the base winston library:

Readme

Overview

This logger lib adds some functionality to the base winston library:

  • log function generator with namespace initialization
  • value loader to be reprinted at each subsequent log (for example, if the log function is attached to the req object, it is useful to load user data once only and have it reprinted at each following log)

API

Initialization

init( config )

Initialization must be done before any call of basic logger.

config:

  • namespace: (string) namespace for the basic logger
  • debug:
    • enable: (string|false)
    • prefix: (string) the prefix used before all namespaces for the debug logs (eg: oa:)
  • token: (string) aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

setModuleConfig( config )

Can be used as an init inside each module to modify the configuration of all the loggers used in this module.

Enable debug

You can enable the debug log display with the environment variable DEBUG, for example:

DEBUG=service* yarn test

Basic logger

The basic logger is available by doing:

const log = require('logs');

Namespaced logger

A namespaced logger is gettable by doing:

const log = require('logs')('namespace');

// or

const log = require('logs')('namespace', preloadedData);

Common methods

Usable with basic logger and namespaced loggers.

  • setConfig( config ): configure the transports of logger with a specific new config, same shape of config as in init

  • loadMetadata( data ): preload metadata

  • clearMetadata(): clear preloaded metadata

  • getTransports(): get the transports used by logger, can be { debug, logentries }

Logging methods

Each level is given a specific integer priority. The higher the priority the more important the message is considered to be, and the lower the corresponding integer priority. For example, npm logging levels are prioritized from 0 to 5 (highest to lowest):

{ error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }

logger( 'error', 'message %s %j %d', ...placeholderTokens, meta )
logger( 'warn', 'message %s %j %d', ...placeholderTokens, meta )
logger( 'info', 'message %s %j %d', ...placeholderTokens, meta )
logger( 'verbose', 'message %s %j %d', ...placeholderTokens, meta )
logger( 'debug', 'message %s %j %d', ...placeholderTokens, meta )

logger.error( 'message %s %j %d', ...placeholderTokens, meta )
logger.warn( 'message %s %j %d', ...placeholderTokens, meta )
logger.info( 'message %s %j %d', ...placeholderTokens, meta )
logger.verbose( 'message %s %j %d', ...placeholderTokens, meta )
logger.debug( 'message %s %j %d', ...placeholderTokens, meta )

logger.log( 'error', 'message %s %j %d', ...placeholderTokens, meta )
logger.log( 'warn', 'message %s %j %d', ...placeholderTokens, meta )
logger.log( 'info', 'message %s %j %d', ...placeholderTokens, meta )
logger.log( 'verbose', 'message %s %j %d', ...placeholderTokens, meta )
logger.log( 'debug', 'message %s %j %d', ...placeholderTokens, meta )

The message argument can be omitted for log only metadata.

The message argument is a string containing zero or more placeholder tokens. Each placeholder token is replaced with the converted value from the corresponding argument. Supported placeholders are:

%s - String.
%d - Number (integer or floating point value).
%i - Integer.
%f - Floating point value.
%j - JSON. Replaced with the string '[Circular]' if the argument contains circular references.
%% - single percent sign ('%'). This does not consume an argument.

If the placeholder does not have a corresponding argument, the placeholder is not replaced.

To log an error you can use one of the following methods:

logs('error', new Error('Une erreur ici !'));
/*
Error: Une erreur ici !
  at Context.it (/home/bertho/OpenAgenda/logs/test/index.js:133:45)
  at callFn (/usr/local/lib/node_modules/mocha/lib/runnable.js:326:21)
  at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:319:7)
  at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:422:10)
  at /usr/local/lib/node_modules/mocha/lib/runner.js:528:12
  at next (/usr/local/lib/node_modules/mocha/lib/runner.js:342:14)
  at /usr/local/lib/node_modules/mocha/lib/runner.js:352:7
  at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14)
  at Immediate.<anonymous> (/usr/local/lib/node_modules/mocha/lib/runner.js:320:5)
  at runCallback (timers.js:789:20)
  at tryOnImmediate (timers.js:751:5)
  at processImmediate [as _immediateCallback] (timers.js:722:5) +0ms
*/

logs('error', 'On a eu une erreur:', new Error('Une erreur ici !'));
/*
On a eu une erreur: Error: Une erreur ici !
  at Context.it (/home/bertho/OpenAgenda/logs/test/index.js:133:45)
  at callFn (/usr/local/lib/node_modules/mocha/lib/runnable.js:326:21)
  at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:319:7)
  at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:422:10)
  at /usr/local/lib/node_modules/mocha/lib/runner.js:528:12
  at next (/usr/local/lib/node_modules/mocha/lib/runner.js:342:14)
  at /usr/local/lib/node_modules/mocha/lib/runner.js:352:7
  at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14)
  at Immediate.<anonymous> (/usr/local/lib/node_modules/mocha/lib/runner.js:320:5)
  at runCallback (timers.js:789:20)
  at tryOnImmediate (timers.js:751:5)
  at processImmediate [as _immediateCallback] (timers.js:722:5) +0ms
*/

logs('error', 'On a eu une erreur: %s', new Error('Une erreur ici !')); // Logs only message of the error
/*
On a eu une erreur: Error: Une erreur ici !
*/