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

format-logs

v2.0.1

Published

A formatter for Node.js console logs.

Downloads

3

Readme

Format Logs

Simple and flexible to use formatting for terminal console logs.

examples

Install

npm i format-logs

Usage

import { custom } from 'format-logs';

console.log(custom('Hello World', 'green'));

It is also possible to easily compose complex large styles.

import { custom } from 'format-logs';

// Using method composition
// Creates an string with bold font, yellow background and green text color
// All text styles can be used like this
console.log(log.green.bgYellow.bold('Hello World'));

// Creates an string with blue background, white text and bold font style.
console.log(custom('Hello World', 'bgBlue', 'white', 'bold'));

// It's also possible to combine it with normal strings.
console.log(`${custom('Hello', 'brightBlue', 'bgWhite', 'underline')} World!`);

There are also already defined styles.

import { title, sub, err, warn, info } from 'format-logs';

// Creates a title string;
console.log(title('title'));

// Creates a subtitle string;
console.log(sub('subtitle'));

// Creates an error string;
console.log(err('error'));

// Creates a warning string;
console.log(warn('warning'));

// Creates an information string;
console.log(info('information'));

Defined styles examples

Styles

  • bold : Bold style text.
  • light : Light style text.
  • italic : Italic style text.
  • underline : Underline style text.
  • crossed : Crossed style text.

Colors

  • black : Black text color.
  • red : Red text color.
  • green : Green text color.
  • yellow : Yellow text color.
  • blue : Blue text color.
  • magenta : Magenta text color.
  • cyan : Cyan text color.
  • white : White text color.
  • brightBlack : Bright black text color.
  • brightRed : Bright red text color.
  • brightGreen : Bright green text color.
  • brightYellow : Bright yellow text color.
  • brightBlue : Bright blue text color.
  • brightMagenta : Bright magenta text color.
  • brightCyan : Bright cyan text color.
  • brightWhite : Bright white text color.

Background colors

  • bgBlack : Black background color.
  • bgRed : Red background color.
  • bgGreen : Green background color.
  • bgYellow : Yellow background color.
  • bgBlue : Blue background color.
  • bgMagenta : Magenta background color.
  • bgCyan : Cyan background color.
  • bgWhite : White background color.
  • bgBrightBlack : Bright black background color.
  • bgBrightRed : Bright red background color.
  • bgBrightGreen : Bright green background color.
  • bgBrightYellow : Bright yellow background color.
  • bgBrightBlue : Bright blue background color.
  • bgBrightMagenta : Bright magenta background color.
  • bgBrightCyan : Bright cyan background color.
  • bgBrightWhite : Bright white background color.