beautiful-log
Because logging should be easy and beautiful.
Installation
npm install beautiful-log
Usage
beautiful-log
requires rest arguments in order to run properly. This means that you must either use Node 6.x (in
which rest arguments are enabled by defualt) or run with the --harmony
flag.
var log = require("beautiful-log");
log.log("log (default)");
log.info("info (blue)");
log.warn("warn (yellow)");
log.error("error (red)");
log.verbose("verbose (gray/grey)");
log.ok("ok (green)");
log.log("<magenta>Color tags are also supported <black>(even nested)</black> in log calls!</magenta>");
log.log("<#af00af>This color is purple af</#af00af>");
log.addColor("veljean", "#024601");
log.log("<veljean>Your time is up and your parole's begun</veljean>")
log.addColor("gray", "#333333");
log.log({ objects: "can be logged as well, and are colorful", colorful: true });
log.logf("You can %s", "use format strings, too.");
log.addFormat("date", "%s %2d, %4d");
log.logf("date", "October", 23, 2077);
log.logf("date", "January", 1, 2000);
log.divider("DIVIDE");
log.divider("-D-I-V-I-D-E-", "-");
log.timestamp();
log.line();
log.line(2);
log.indent();
log.log("This text is indented one level.");
log.log("All text will be indented until the unindent is called.")
log.indent();
log.log("Multiple indentation levels work.");
log.unindent(2);
log.log("You can also pass a parameter to indent/unindent multiple times in one call.");