Yet Another Node.js Logger: femto-logger


Ok, so I don’t know if we really need another logging framework, but after looking at various ones available in the registry, I found that I was implementing my own repeatedly, so I figured I would just stick it out there.

I had the goals of a logging framework that:

The NPM package is here and Git project here.

Usage, as I mentioned, is dead simple:

var logging = require('femto-logger');'Something happened.');

But, it can still be pretty well customized…

// Turn coloring on or off...
logging.config.coloring = true | false;

// Set debug color to bright cyan...
logging.config.colors.debug = logging.BRIGHT_CYAN;

// Set label for fatal log lines from FATAL to RED ALERT...
logging.config.labels.fatal = 'RED ALERT';

// Set format of timestamp (follows moment formatting)... = logging.ISO8601 | 'HH:mm:ss.SSS';

I just added printf-style message formatting as well, so something like this will work:

logging.debug('This will work now (%s, %d)', 'abc', 789);

I hope someone finds this useful!


Now read this

Dynamically typed languages and Tolerant Readers

I’ve been playing around with Node.js for the past few months, and I must admit that I’m pretty hooked on it. Having lived in a statically typed world for the past 20 years, it can be a bit alarming to not be able to rely on the type of... Continue →