Logg your messages, dispatch your events

Beware: old content below -- I do not maintain the Logg library anymore.

Dissatisfied with Rails’ internal logger and the available alternatives (too light, too heavy…), I have worked on my own little logging library. Reinventing the wheel feels so good!

Its name is Logg and obviously, it aims at being both simple and efficient. It is also quite generic: one may actually use it to format and display any kind of stuff, not necessarily for a logging purpose…

Core features I needed:

  • Advanced text formatting -- I focused on that aspect of the lib and leveraged Tilt.
  • Easy data-dispatching -- I’m not talking about a protocol or anything, just the ability to yell something to whoever wants to know about it (think Pub-Sub).

The first point is built-in: Logg supports advanced templating, now get creative. The README gives several examples about how to use the "method building" DSL provided by Logg to output fancy messages. To handle data dispatching, I would actually recommend using a third-party library, such as AS::Notifications, Onfire; or any Pub-Sub mechanism really. Logg just tries to make it easy to plug those things together, thanks to its block-everywhere interface and its lightweight DSL.

So here it is: a simple, extensible logging library. Tell me if you happen to use it!

Aug 3, 20111 min readSummary: Presenting a simple, extensible log engine.