Woodman has been manufactured on the assembly line by Joshfire Factory workers to help develop and maintain various cross-device Web applications and other backend tools.
"Surely, you've heard about that thing called console
?", you may ask. "Wake up, this is JavaScript, not Java!", you might add. Yes indeed! The console
is extremely useful to debug an application. It is not quite enough, mainly because:
console
object. Perhaps surprisingly, the devices that do not are the ones that you might want to support to surf the HTML5-in-all-the-things wave. For instance, many connected TVs do not expose a debugging environment. Using console
calls is simply not an option on such devices.console
is all-or-nothing, you cannot disable logs from certain parts of your application
without actually removing them from the code.The net result is that console
is underused in most JavaScript applications. More precisely, most applications are written without log traces; console
statements are only ever used temporarily to nail down specific issues at debug phase, or to report errors.
The Apache Log4j introduction provides a handful of reasons why flexible logging is useful. These reasons are valid whether the underlying language is Java, JavaScript, C, Python...
In the end, log4j provides a very good abstraction over console
that solves the problems raised above for a reasonable cost: that of having to manage a Logger
instance per module.
While Woodman attempts to follow Apache Log4j 2 as closely as possible, it does not implement all its features. In particular, compared to Apache Log4j 2, Woodman comes with:
API functions in Woodman may also not have the exact same signature as those specified in log4j to stick to more JavaScript-friendly paradigms. For instance, log levels in JavaScript are lower-case strings, as opposed to a proper enumeration in Apache Log4j 2.
New features get introduced in Woodman when the need arises. If you need something that does not yet exist, check Contribute to Woodman and get in touch!
Woodman is not the first logging library written in JavaScript. Winston is a good example of a logging library for node.js. Closer to Woodman, the log4javascript library is a nice and complete implementation of log4j for Web browsers (and can easily be adapted to run in node.js applications).
We decided to start over because we needed:
The Woodman library is licensed under the MIT license. Copyright (c) 2013 Joshfire. All rights reserved.
The core source code of the Woodman library uses, extends or was at least partially based on other great open-source projects:
Additionally, the precompiler uses:
The test runner relies on:
Woodman distributions are prepared with: