ear-fung.us I’m a programmer. I’m also pro-grammar.

AIRLogger

AIRLogger is a quick way to create a log file for debugging an Adobe AIR AJAX application.

All you have to do is include the AIRLogger.js file in your application's window. From there you have access to log anything you want using the command:

log.write("text or variables to be logged");

If the file doesn't already exist, one will be created for you on your desktop called "application.log". Both the location and the file name can be easily changed in the js file. Possible locations could be "desktopDirectory" (default), "applicationDirectory", "applicationStorageDirectory", or a string to the path of your choice. I put it on my desktop for easy access because I'm usually just going to delete the file after I'm done looking at it anyway.

You can customize what is written to the file, but I've included what I think would be of most interest to a developer trying to debug their code. Each line in the text file will look like this:

Thu Aug 14 20:42:44 2008 - air:MAC 9,0,124,0 res:1440x900 os:Mac OS 10.5.4 mem:6397952 txt:DebugMessage

It shows you:

  • Date and Time
  • Version of Flash installed on the system
  • Current screen resolution
  • Operating system type and version
  • Amount of memory currently being used by the AIR application (in bytes)
  • Your debug message that was passed to the "write()" method

AIRLogger is licensed under under the Creative Commons Attribution 3.0 License which means that this work is free for use in both personal and commercial projects but requires leaving author name, author link, and the license info intact in the file.


I wrote this for my personal use, but if you come up with any enhancements, I'd love to hear from you in the comments below. I might even incorporate the changes in the next release.

Download AIRLogger

Comments (1) Trackbacks (0)
  1. Hi!

    This class was very useful, thanks for sharing. I would note however that it requires the Prototype library to function. I rewrote it really quickly to run on it’s on though.

    Thanks again!

Trackbacks are disabled.