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

beautify-console-log

v1.2.1

Published

This is a further beautification and encapsulation of the 'console' object, including console. log, console. info, console. warn, and console. error.

Downloads

21

Readme

beautify-console-log

Introduction

This is a further beautification and encapsulation of the 'console' object, including console. log, console. info, console. warn, and console. error.

You can add custom console printing prefixes and beautify the content (rule reference https://developer.mozilla.org/en-US/docs/Web/API/Console , node environment reference https://en.wikipedia.org/wiki/ANSI_escape_code#Colors), can close console printing at any time, supporting node.js environments. Please view the effect on the console.

Effect demonstration

version >= V1.2.1 Added background color

node.js 控制台 web端 控制台

version < V1.2.1

node.js 控制台 web端 控制台

Installation Tutorial


npm i beautify-console-log --save

or


yarn add beautify-console-log

Instructions for use

  1. Simple use
import BeautifyConsole from "beautify-console-log";

const log = BeautifyConsole.getInstance();

//The usage is consistent with the normal console.info()

Log.info(1234, '4', [3, 5]);

or


const log = new BeautifyConsole();

//The usage is consistent with the normal console.info()

Log.info(1234, '4', [3, 5]);

Or directly use the dist/index. js file

<script src="./dist/index.js">
const log = BeautifyConsole.default.getInstance()

log.info(1234, '4', [3, 5])

log.log(1234)

log.close().warn('no show')

log.open().log('show log')

log.error(1234)

log.setPadStartText('log', 'hello world').log(1234)
  1. Supported console types

const log = BeautifyConsole.getInstance();

Log.info(1234, '4', [3, 5]);

Log.log(1234, '4', [3, 5]);

Log.warn(1234, '4', [3, 5]);

Log.error(1234, '4', [3, 5]);
  1. Add custom console log headers

const log = BeautifyConsole.getInstance();

Log.setPadStartText('log ','hello world').info(1234,'4 ', [3, 5]);
  1. Close log Close the corresponding console log types when passing in parameters, and close all types without passing them. supports chain calling.
const log = BeautifyConsole.getInstance();
log.close('info');
log.close('log');
log.close('warn');
log.close('error');
log.close();
log.close().open('error');

// or
log.open('error').open('log').open('warn').open('info');

// or
log.close('error').info('closed error');
log.close('error').error('closed error');

// or
log.close('error').open('info');
log.close('error').open('info').info('info...');
  1. Open log Open the corresponding console log types when passing in parameters, and open all types without passing them. supports chain calling.
const log = BeautifyConsole.getInstance();
log.open('info');
log.open('log');
log.open('warn');
log.open('error');
log.open().close('info');

//or
log.open('error').open('log').open('warn').open('info');

// or
log.open().info('closed error');
log.open('error').error('closed error');

// or
log.close('error').open('info');
log.close('error').open('info').info('info...');

Participation contribution

  1. Fork warehouse

  2. Create a new Feat_Xxx branch

  3. Submit Code

  4. Create a new Pull Request