global-console-prefix

2.0.0 • Public • Published

global-console-prefix

Build Status

Add a your own prefix to every single console message.

Usage

require("global-console-prefix")("[MONEY_APP]");
 
console.log("starting execution", {name: "crawler"});
console.info("starting execution", {name: "crawler"});
console.warn("starting execution", {name: "crawler"});
console.error("starting execution", {name: "crawler"});
 
//Output:
//[INFO][MONEY_APP] starting execution { name: 'crawler' }
//[INFO][MONEY_APP] starting execution { name: 'crawler' }
//[ERROR][MONEY_APP] starting execution { name: 'crawler' }
//[ERROR][MONEY_APP] starting execution { name: 'crawler' }

Remarks

Executes the default console methods when no prefix is specified.

Hides the log level when a second parameter is specified.

require("global-console-prefix")("[MONEY_APP]", true);

Readme

Keywords

Package Sidebar

Install

npm i global-console-prefix

Weekly Downloads

4

Version

2.0.0

License

ISC

Last publish

Collaborators

  • camilin87