Logger

When building your first website in Flash you initially use the trace() function. But after a while you start to feel the need for more. There are a lot of ‘loggers’ available on the web. Personally I prefer Trazzle because it’s a very lightweight native mac application. But when working with colleagues who don’t use a mac, Trazzle is no option. It can be hard to choose a good logger everybody likes. That is why I created a project that enables you to use all the loggers you want with one simple script. I called it ‘Logger’ (don’t laugh). And you can use it with the following syntax:

Logger.debug("Logger traces a debug message");

That is not bad, right? Almost every logger has different debug levels, that is why I implemented the most important ones in the script (debug/error/fatal/info/critical/status/warning and notice). To log a message choose one of the following;

Logger.debug("Logger traces a debug message");
Logger.error("Logger traces an error message");
Logger.fatal("Logger traces a fatal message");
Logger.info("Logger traces an info message");
Logger.critical("Logger traces a critical message");
Logger.status("Logger traces a status message");
Logger.warning("Logger traces a warning  message");
Logger.notice("And finally Logger traces a notice message");

Before you do this you first need to initialize the loggers you want. I created connectors for Trazzle, SOSMax, DeMonsterDebugger, Yala and Flash (trace). To enable all these loggers together (which is not recommended) call;

Logger.addLoggers([new MonsterDebuggerConnector(this),new FlashConnector(),new TrazzleConnector(),new YalogConnector(),new SosMaxConnector()]);

This is how the output looks on all the different connectors (note how every logger shows the line number and class of the log);

Trazzle (website)

Screen shot 2009-09-10 at 17.44.27

De Monster Debugger (website)

Screen shot 2009-09-10 at 17.44.58

SOSMax (website)

Screen shot 2009-09-10 at 17.46.17

Yala (online version)

Screen shot 2009-09-10 at 22.07.51

Flash:

Screen shot 2009-09-10 at 17.43.57

I created a zip package with everything you need (Demo FLA and source). If you have any suggestions please let me know!


THE COMMENTS:



  • What erik said 2 hours later:

    Cool, I have the same thing, only it doesn't contain Yala. I'll take over this one now ;-)

    Thanks dude.

  • What Thijs said 13 days later:

    Nice, looks like the Log class from ASAP. Accept that one works with events, instead of a list of connectors. But you can actualy do the same.

  • What Form Generator said 346 days later:

    You made some good points there. I did a search on the topic and hardly found any specific details on other sites, but then great to be here, seriously, thanks…

    - Andre

Leave a Reply