Simple logging library for node.js.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mort 14f0179860 updated package.json version 4 years ago
.gitignore initial commit 4 years ago fixed README 4 years ago
index.js added log.error 4 years ago
package.json updated package.json version 4 years ago


mLogger is a very simple logging library for node.js.


Install like any other NPM library:

npm install --save mlogger


var log = require("mlogger");

Logger has 4 methods for logging:"foo");   // yyyy/mm/dd HH:MM:SS INFO: foo
log.notice("foo"); // yyyy/mm/dd HH:MM:SS NOTICE: foo
log.warn("foo");   // yyyy/mm/dd HH:MM:SS WARNING: foo
log.error("foo");  // yyyy/mm/dd HH:MM:SS ERROR: foo
log.die("foo");    // yyyy/mm/dd HH:MM:SS ERROR: foo

After log.die, the process will immediately exit.

If an error object is passed instead of a string, a stack trace will be printed, like this:

log.notice(new Error("foo"));

// yyyy/mm/dd HH:MM:SS NOTICE: foo - stack trace:
// Trace: [Error: foo]
//     <stack trace>

To set a different color theme, use setTheme:

	timestamp: "green"

The available properties for setTheme is:

  • timestamp: timestamp, default: “blue”
  • level_0:, default: “grey”
  • level_1: logger.notice, default: “yellow”
  • level_2: logger.warn, default: “red”
  • level_3: logger.die/logger.error, default: [“bold”, “red”]

The available values for themes are listed here: