drop in replacement for console (evacuated from NSA/Microsoft Github)

anonymous 44a436d79c preliminary debian packaging %!s(int64=5) %!d(string=hai) anos
debian 44a436d79c preliminary debian packaging %!s(int64=5) %!d(string=hai) anos
.gitignore d610514722 Update README %!s(int64=11) %!d(string=hai) anos
LICENSE.md dbf97a7117 Add License %!s(int64=7) %!d(string=hai) anos
README.md 35b263f113 install instructions, degithubbing %!s(int64=6) %!d(string=hai) anos
demo.js c50514b389 Update demo %!s(int64=11) %!d(string=hai) anos
index.js f88b86fb9f Update to chalk %!s(int64=8) %!d(string=hai) anos
log_table.js f88b86fb9f Update to chalk %!s(int64=8) %!d(string=hai) anos
package.json dbf97a7117 Add License %!s(int64=7) %!d(string=hai) anos
screenshot.png c50514b389 Update demo %!s(int64=11) %!d(string=hai) anos
test.js f88b86fb9f Update to chalk %!s(int64=8) %!d(string=hai) anos

README.md

Better Console

Screenshot

A better console for Node.js

better-console is a drop-in replacement for node's default console which gives you colors and more methods in console.

How to use it

You can override console object itself or assign better console to another variable. It's completely safe to override the native console object because better console calls native console methods for methods that are already available in it.

var console = require('better-console');

console.log("This is a log information");
console.warn("Warning!");
console.info("Information");
console.table([ [1,2], [3,4] ]);
console.time("Timer");
console.timeEnd("Timer");
console.dir(myObject);

Methods

console.log, console.warn, console.error, console.info, console.debug, console.dir, console.trace

These methods work exactly same as native console methods but with colors for warn, info or error

console.clear

Clears the screen

console.table

Draws a table of data if a 2d array or object passed to it

console.time

Creates a new timer under the given name. Call console.timeEnd(name) with the same name to stop the timer and print the time elapsed.

console.timeEnd

Stops a timer created by a call to console.time(name) and write the time

console.trace

Prints a stack trace of JavaScript execution at the point where it is called. The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function.

console.count

Writes number of times each argument is called with blue color