global-console-prefix
v2.0.0
Published
Add a commong prefix to every single console.log message
Downloads
26
Readme
global-console-prefix
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);