IT IS HERE! Get Smashing Node.JS on Amazon Kindle today!
Show Posts
← Back to homepage

I just created a module named console-trace that does one very simple yet very useful thing: prepend the line number and filename to console calls.

To leverage it you just need to require('console-trace') and prepend a flag:

console.t.log('Test'); // shorthand

You can learn about a few other options in the GitHub repository.


Charlie Robbins said

I <3 this idea. I may pull this as a dependency in winston :-)

Jack said

Very useful! This will help quite a lot with debugging that low-level code.

Mariusz Nowak said

Can it be accomplished without flag, but by changing internal console methods? In many cases, this would be more handy

James said

Definitely a useful feature, although Chrome developer tools already do this (couldn’t speak to other browsers – essential if they don’t.)

ggg said

I was actually looking for something like this just yesterday!!

Your thoughts?

About Guillermo Rauch:

CTO and co-founder of LearnBoost / Cloudup (acquired by Automattic in 2013). Argentine living in SF.