Skip to content

cshtdd/global-console-prefix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

Add a your own prefix to every single console.log message

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published