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

beautiful-log

v2.0.0-7

Published

Because logging should be beautiful.

Downloads

54

Readme

beautiful-log

Because logging should be easy and beautiful.

Installation

npm install beautiful-log

Usage

beautiful-log requires rest arguments in order to run properly. This means that you must either use Node 6.x (in which rest arguments are enabled by defualt) or run with the --harmony flag.

var log = require("beautiful-log");



////////// Basic Logging //////////

log.log("log (default)");
log.info("info (blue)");
log.warn("warn (yellow)");
log.error("error (red)");
log.verbose("verbose (gray/grey)");
log.ok("ok (green)");

log.log("<magenta>Color tags are also supported <black>(even nested)</black> in log calls!</magenta>");
// Default names: default, black, red, green, yellow, blue, magenta, cyan, white, gray/grey.

log.log("<#af00af>This color is purple af</#af00af>");
// You can also pass any hex color, which gets approximated for your terminal.

log.addColor("veljean", "#024601");
// You can also name your own colors...

log.log("<veljean>Your time is up and your parole's begun</veljean>")
// ...and use them just like the prenamed ones.

log.addColor("gray", "#333333");
// You can even overwrite the default ones if you don't like them.

log.log({ objects: "can be logged as well, and are colorful", colorful: true });
// This is done via util.inspect(), so whatever color settings you have for that will be preserved.

// No matter how you log, the function name, file name, and line number from which you logged are logged as well.



////////// Formatting and Saved Formats //////////

log.logf("You can %s", "use format strings, too.");
// Formatting is powered by sprintf-js, so anything that's valid there is valid here.

log.addFormat("date", "%s %2d, %4d");
log.logf("date", "October", 23, 2077);
log.logf("date", "January", 1, 2000);
// You can also store a format string so you don't have to pass it many times.



////////// Other features //////////

log.divider("DIVIDE");
// Prints a divider that looks like "###### DIVIDE ######", expanding to fill the full console width.

log.divider("-D-I-V-I-D-E-", "-");
// You can also pass a different divider character.

log.timestamp();
// Prints the current time.

log.line();
// Prints an empty line.

log.line(2);
// Prints many empty lines.

log.indent();
log.log("This text is indented one level.");
log.log("All text will be indented until the unindent is called.")
log.indent();
log.log("Multiple indentation levels work.");
log.unindent(2);
log.log("You can also pass a parameter to indent/unindent multiple times in one call.");