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

@rearc/noop-log

v1.0.2

Published

Simple JSON logger for Noop components

Downloads

1

Readme

noop-log

JS logging library for Noop components following Noop standard JSON format. The library is very simple and allows mixed types to be output easily (strings, objects, and Errors). This library is hosted publicly on NPM.

Quickstart

npm install @rearc/noop-log --save
const log = require('@rearc/noop-log')
log.info('something happened', 'over here', {id: 42}, new Error('damn'))

This outputs a single line JSON object with all the arguments above like:

{"level":"info","date":"2018-03-16T19:20:13.951Z","id":42,"inner":{"message":"damn","stack":"Error: damn\n    at repl:1:55\n    at sigintHandlersWrap (vm.js:22:35)\n    at sigintHandlersWrap (vm.js:73:12)\n    at ContextifyScript.Scr
ipt.runInThisContext (vm.js:21:12)\n    at REPLServer.defaultEval (repl.js:340:29)\n    at bound (domain.js:280:14)\n    at REPLServer.runBound [as eval] (domain.js:293:12)\n    at REPLServer.<anonymous> (repl.js:538:10)\n    at emit
One (events.js:101:20)\n    at REPLServer.emit (events.js:188:7)"},"msg":"something happened over here"}

Log Levels

The log output level defaults to info but can be configured through the LOG_LEVEL environment variable. The available levels in order of severity are:

  • log.debug()
  • log.info()
  • log.warn()
  • log.error()
  • log.fatal()

Argument Types

All logging functions accept unlimited arguments of the string, object, and Error types.

  • string all strings provided as arguments will be concatenated (in the order provided) into the msg property of the output event
  • object all object types provided as arguments result in their properties being added to the output event. log.info({id: 42, name: 'foo'}) will result in the output event having the id and name properties applied. This also includes deep objects.
  • Error all JS Error object types will be have their details added to the inner property of the output event. This fits the common case of recording the details of a lower level error along with your own message.