RSS Amplifier

Sridhar Raj Sampath Kumar · Feb 2, 2016

Coloring console logs in nodejs

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Colored console log messages can be helpful in determining the progress of the application when we boot it. Since the application will be started from the console, displaying green for the infos, Red for the error will be helpful in diagnosing on which stage the application has failed. I use SindreSorhus's chalk because it is simple, doesn't extend String.prototype and used by ~4500 other modules.…

Colored console log messages can be helpful in determining the progress of the application when we boot it. Since the application will be started from the console, displaying green for the infos, Red for the error will be helpful in diagnosing on which stage the application has failed.

I use SindreSorhus'schalk because it is simple, doesn't extend String.prototype and used by ~4500 other modules.

Let's get to the code. First, we need to install chalk.

To demonstrate red, we are going to print stack trace of an error.

Read on sridhar.co

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.