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

woveon-logger

v0.0.21

Published

A logging toolkit with: color, file and line number reporting, both aspect and levels of logging, and other sugar in the syntax.

Downloads

23

Readme

woveon-logger

A logging toolkit with: color, file and line number reporting, both aspect and levels of logging, and other sugar in the syntax."

NPM Location

Woveon is an enterprise conversation management software. Using AI and machine learning, it helps businesses take control of their conversations - to provide exceptional customer experience, audit for compliance, and maximize revenue.

Sample output

I inlined the javascript that generated this output.

Sample logger output (from mocha test)

Features

  • Debug mode: Prints line and file of the log message
  • Named log channels (ex. Logger1, Logger2, etc.), levels of concern (info, warn, error, verbose) and aspect-oriented (i.e. cross-cutting through your project).
  • Environment variables override options and aspects (quick reconfig, great for us container and microservice people).
  • Expressive sugar syntax:
    • Colorized output
    • Supports h1,h2,h3 styled tags in log files. logger.h1().info('text after a header 1 breaker')
    • One time use settings via 'with'.
    • styling of different log levels and aspects (which are not lost when toggled off)
    • throwError to display the error message AND throw an exception with the same log message (I know right!).
    • logDeprecated to warn when someone is using an out dated command

Calls, and Things to Know

  • instantiation: const Logger = require('woveon-logger');

  • typical call: logger.info('foo') or logger.verbose('foo') or logger.error('foo')

  • change log level: error, warn, info, verbose, trace, debug, silly

    • ex. logger.lvl('error') or logger.lvl('verbose')
  • aspect-oriented logging:

    • turn aspect on: logger.setAspect('foo'); or off: logger.setAspect('foo', false)
    • log when aspect set: logger.aspect('foo', 'my logging message');
  • throw Error: logs the message and throws an error with that message: logger.throwError('foo')

  • with and set: changes logging options for a one time call (with) or permanently (set)

    • logger.with('color', 'blue').info('prints this blue')
  • headers: add spacing and dividers to your log files, to make them more human readable: h1(), h2(), h3()

    • logger.h1().info('Important message!')

Options

These options can be set at start new Logger('mylogger', {level: 'verbose', debug: true}), at run time logger.set('color', 'blue'), or at run time for use in only the next call logger.with('color', 'blue').

  • level (default: 'info'): logging level... if at or lower, print message
  • debug (default: false): whether to print line and file information
  • debugOnError (default: true): whether to print line and file information for error and warnings
  • timeSinceStart (default: false): prints zulu time when false, time since start of execution if true
  • lblCharLen (default: 7): how many fixed characters to provide to displaying the label
  • dbCharLen (default: 40): how many fixed characters to provide to display the debug file and line number
  • showName (default: false): whether to show the logger name
  • trimTo (default: 'src'): how far back to trim displaying file names
  • outputTo (default: 'console'): can be set to 'string' to return the string instead of print it to console.
  • color (default: false): sets color, overriding 'colors'
  • colors (default: {'default' : 'none', 'error' : 'red', 'warn' : 'yellow', 'info' : 'green'}): can define default colors per log level

Environment Variables

WOV_LOGGER_OPS - JSON format to overwrite logger options, by name. ex. export WOV_LOGGER_OPS='{"logger1" : {"color" : "blue"}, {"logger2" : {"color" : "green"}}'

WOV_LOGGER_ASPECTS - Space separated aspects to turn on (and with '!', turn off). ex. export WOV_LOGGER_ASPECTS='ASP1 ASP2 !ASP3'