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

colorjslogger

v3.0.1

Published

Write colorful logs in browser console.

Downloads

38

Readme

colorjslogger

npm version license

Fast and lightweight colorful JS Logger for the browser and Nodejs. It is a perfect logger that supports all browsers.

It allows to print color logs with pre-defined 5 levels of logging (info, warning, error, success, debug). You can enable the VERBOSE flag to print debug logs during the development phase and you can disable it by setting VERBOSE flag to false to avoid printing confidential logs in production.

Features

  • Fast and lightweight
  • Supports multi-color for browser console logs
  • Records all types of logs and allow download it as a file

Requirements

  • None

Installation

NPM

You can install colorjslogger as a dependency using NPM.

$ npm install colorjslogger --save

Yarn

You can install colorjslogger as a dependency using Yarn.

$ yarn add colorjslogger

CDN

json2csv plainjs modules is packaged as an ES6 modules. If your browser supports modules, you can load json2csv plainjs modules directly on the browser from the CDN.

You can import the latest version:

<script type="module">
  import jslogger from 'https://cdn.jsdelivr.net/npm/colorjslogger@latest/src/jslogger.min.js';

  jslogger.info('JSLOGGER', 'Imported ES6Module directly in the browser');
</script>

You can also select a specific version:

<script type="module">
  import jslogger from 'https://cdn.jsdelivr.net/npm/[email protected]/src/jslogger.min.js';

  jslogger.info('JSLOGGER', 'Imported ES6Module directly in the browser');
</script>

Usage

try {
    jslogger.info(process, message);
    jslogger.warning(process, message);
    jslogger.error(process, message);
    jslogger.success(process, message);
    jslogger.internal(process, message);
    jslogger.debug(process, message);
} catch (err) {
  console.error(err);
}

Parameters

  • process (string): Name of the process or a function in which it is used.
  • message (string): Actual log message that needs to log in the console.
Note

Debug logs will only work if the VERBOSE property is set to true. Here is an example how to do it:

jslogger.setLevelToVerbose(true);

Example

jslogger.info('Authentication', 'Connection in progress');

Log Output Format

UTC Date | AppName | [Process] :: Message

Output

Mon Aug 12 2019 22:37:57 | JSLogger | [Authentication] :: Connection in progress

Change the Default AppName

jslogger.setAppName('SuhaibJanjuaLogger');
jslogger.info('Authentication', 'Connection in progress');

Mon Aug 12 2019 22:37:57 | SuhaibJanjuaLogger | [Authentication] :: Connection in progress

Log information as internal to avoid printing it into the browser console

jslogger.internal('Authentication', 'User with email su****************.com just logged in.');

Download

You can download the recorded logs by the following method:

jslogger.downloadLogs()

License

See LICENSE.md.