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

pretty-logger

v0.1.2

Published

A colorized extenstion of 'basic-logger' supporting error, warning, debug and info messages with timestamp.

Downloads

94

Readme

Pretty-Logger

Pretty Logger for nodejs allows for color coded error, warning, info, debug and trace console messages with (or without) timestamp. This is a modified version of the basic-logger project to use colors.

Installation

npm install pretty-logger --save

Accepted Colors

black, red, green, yellow, blue, magenta, cyan, white, gray, grey, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, dim, rainbow, zebra, america, random, reset

Usage

	var Logger = require('pretty-logger');
	// configure level one time, it will be set to every instance of the logger
	Logger.setLevel('warning'); // only warnings and errors will be shown
	Logger.setLevel('warning', true); // only warnings and errors will be shown and no message about the level change will be printed

	var customConfig = {
		showMillis: true,
		showTimestamp: true,
		info: "gray",
		error: ["bgRed", "bold"],
        debug: "rainbow"
	};

	var log = new Logger(customConfig) // custom config parameters will be used, defaults will be used for the other parameters
	//var log = new Logger(); // you can also do this to accept the defaults

	log.error("An error occurred"); // will be red
	log.warn("I've got a bad feeling about this!"); // will be yellow
	log.info("Something just happened, thought you should know!"); // will be green
    log.debug("The value of x is: " + x); // will be blue
    log.trace("Heres some more stuff to help out."); // will be gray

Config options

For the error, info, warn, debug, and trace properties you can find the accepted colors on the colors repo.

  • showTimestamp - Show the timestamp with every message.
  • showMillis - Show milliseconds in the timestamp.
  • printObjFunc - The function to apply objects to, if logged. Default is util.inspect.
  • prefix - String that is prepended to every message logged with this instance.
  • error- String or array that represents the color of the error text. Default is "red".
  • info- String or array that represents the color of the info text. Default is "green".
  • warn- String or array that represents the color of the warning text. Default is "yellow".
  • debug- String or array that represents the color of the debug text. Default is "cyan".
  • trace- String or array that represents the color of the trace text. Default is "grey".

Future versions

  • log to file

v0.1.2

  • Add ability to have multiple color/styles -Credit to wvbe
  • Fix issue #3 reported by jackwilsdon