New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

colorsole

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorsole

Put colors in your debugging messages

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

colorsole

Put colors in your debugging sessions. By Fabio Rotondo.

Installation

yarn add colorsole

or

npm install --save colorsole

Usage

var Colorsole = require ( 'colorsole' );

// once instantiated, colorsole can be used as a console replacement
console = new Colorsole ();

// There are some options and attributes you can call while creating a Colorsole.

// now just use it with debug, info, warn, error methods
// NOTE: for better results, pass at least two arguments to a colorsole debug method
// the first argument will be used as a line title
console.debug ( "DEBUG", "This is an info message" );
console.info  ( "INFO", "This is an info message" );
console.warn  ( "Warning", "This is an info message" );
console.error ( "ERROR Message", "This is an info message" );

API

Colorsole ( level = INFO, theme = 'dark', stack = 0, date = 0 )

Parameters during Colorsole creations are:

- level:    Level of output of the Colorsole.
			These are the available values:

				- Colorsole.LOG_LEVEL_DEBUG  : the less important message
				- Colorsole.LOG_LEVEL_INFO   : an informative message  [default]
				- Colorsole.LOG_LEVEL_WARN   : a warning
				- Colorsole.LOG_LEVEL_ERROR  : an error message

- theme:	Color scheme to be used. At the moment, only `dark` is available.

- stack: 	Flag T/F. If set to true, the text line shows filename and line number where the message has been written.

- date:     Flag T/F. If set to true, the text lines shows date (YYYYMMDD format) and time (HHMMSS format) 

You can change the level at runtime using this syntax:

// After this line, only error messages will be shown to the console
console.level = Colorsole.LOG_LEVEL_ERROR;

Also stack and date can be toggled at runtime, in this way:

// Enable show stack
console.show_stack = true;

// disable date
console.show_date = false;

debug ( ...args ) - writes a debug messate to the console

info ( ...args ) - writes an info level message to the console

warn ( ...args ) - writes a warning to the console

error ( ...args ) - writes an error to the console

Changelog

0.1.0: First release

Keywords

console

FAQs

Package last updated on 05 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts