Need help with better-log?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

RReverser
211 Stars 6 Forks MIT License 14 Commits 0 Opened issues

Description

console.log wrapper for a bit more readable output in Node.js

Services available

!
?

Need anything else?

Contributors list

No Data

better-log

UPDATE: This is no longer necessary in Node.js 10.x.x as it colors output of

console.log
by default.

console.log wrapper for a bit more readable output in Node.js

Tired of seeing hardly readable outputs like this?

regular console.log

Replace them with something more elegant!

better log

Usage

Patching built-in
console
(API is 100% compatible)

require('better-log/install'); // ES6: import 'better-log/install';
console.log({ x: 1, y: 'prop' });
console.error('Something bad happened :(');

or

require('better-log').install({ depth: 2 }); // optional config
console.log({ x: 1, y: 'prop' });
console.error('Something bad happened :(');

Restoring native
console.log
and
console.error
:

require('better-log').uninstall();

Manual usage as a regular function

var log = require('better-log')/* .setConfig({ depth: 2 }) */;
log({ x: 1, y: 'prop' });
log.error('Something bad happened :(');

That's it!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.