Oct 04 2013

intel 0.2

I’ve already pushed intel 0.2 out the door, after a week of tweaking and massaging it into Persona repos. Here’s the changelog, explanation after:

  • [new] Filters
  • [new] Handler timeout option
  • [new] pid included in LogRecord
  • [new] use JSON with intel.config()
  • [changed] Promises are now LazyPromises
  • [changed] printf is now a small, internal, much faster implementation
  • [removed] node v0.6 support


There was already a fair amount of filtering possible in v0.1, by combining log levels and named loggers. However, it became apparent that you’d want to also be able to filter messages on arbitrary details, and there wasn’t a super easy way to do that. Now you can. Here’s an example filter:

 handler.addFilter(new intel.Filter(/user/g));

This filter means that the handler will only receive messages that include the string “user” in the message text.

config with JSON

Configuration was powerful, but it required a a JavaScript file to provide Handler classes. Since we use JSON files to define our configuration for our servers, it was immediately noticed that intel needed this as well. So, now, the class property of Handlers and Filters accepts a String, which will be used to require the class. Intel’s handlers are available like this: intel/handlers/console.


I set up some benchmarks to see just much power intel sucks up, and then cried a little. Clearly, comparing speed to the basic console.log was an exercise meant for trolls, but I also compared against winston. Removing some Array.forEachs, using a light-weight printf, and using LazyPromises made intel faster than winston (woot!).

Specifically, Promises were the biggest slow down. They’re awesome control structures, but boy are they slow. Since most people won’t ever want them anyways, it would suck if everyone had to pay their compute cost. So, log methods now return a proxy with a getter for then. When then is accessed the first time, the Promises are constructed, and handed to the caller. You only pay the cost on the few times you really want their convenience.

intel 0.2

As always, file bugs or feature requests at the issuer tracker. I’m still aiming to be able to call intel at v1.0 soon, so any feedback will help shape this into an excellent go-to logging library.

  • #javascript
  • #programming
  • #planet
  • #intel
  • #logging
  • #nodejs