LogBook, now for pure Actionscript 3 projects
A while back we released LogBook, an AIR based application for logging messages from Flex applications. The feedback from the project has been great and the team is constantly working to add features to LogBook. However, as we used LogBook within CIM, we kept hitting a couple of issues with the Flex logging framework. One of the main issues was that not all projects we work on are Flex based. A lot of times we work on pure AS3 projects and sometimes even Flash CS3 projects. Using the Flex logging framework here was not really an option. One main reason for the problems was the dependency of the logging framework on other members of the Flex framework, most notably the ResourceBundle dependency. In AS3 projects in Flex Builder, including the ResourceBundle swc seems to fix this but that completely doesn't work in Flash CS3.
Before adopting the Flex framework, within CIM we had our own internally developed frameworks (the AS2 version called Flashcore and the new AS3 version called Pyro. More news on Pyro in a few days as well so stay tuned). The framework had a completely developed logging implementation as well, which is really close to the Flex logging framework (both of ours and Flex's logging implementation was inspired by the logging frameworks in Java, most notably Log4J). Today we finally finished the LogBook console for the CIM logging framework and released it all into the LogBook SVN repository.
Like the Flex logging framework, the main class here is a class named Logger as well. However, unlike the Flex logging framework, you do not request the Logger for an ILogger instance. Instead sending logging messages here is as easy as calling one of the static methods on the Logger class. For example, for logging messages that are at the Fatal level, you call Logger.fatal() method. The first parameter to any of the logging messages is the reference to the source of the message itself and the second is the message you want to log.
Similar to the concept of Logging Targets (implementing the Flex ILoggingTarget interface) in Flex, our logging classes use a concept of Logging Consoles, implementing an IConsole interface. Out of the box, you get the TraceConsole and the LogBookConsole (There are a couple of other consoles as well that are not completely tested yet, like a Flex component based on TitleWindow that can float within the application). So at the start of your application's init phase, create a console and set it as the console for Logger.
So at startup, do:
var console:LogBookConsole = new LogBookConsole('_localconnectionname');
Logger.console = console;
thats it, now you can send messages to LogBook by calling:
Logger.info(this, "Something crazy happened");
Logger.fatal(this, "KaBoom");
Logger.warn(this, "Dont say you haven't been warned");
Hope this helps. The CIM logging framework swc can be found on the featured downloads on the CIM Logbook project. Just include the swc in your application's build path. The documentation can be found here and the source code can be found here.
Feedback is welcome, and if you are willing to help extend the libraries, drop us a message here.
Cheers.