| Tags tutorialarticlesActionSctipt3raseRealaxy |
| 23 September 2011 |
Logging of applications is widely used as alternative or succession for using debugger. The most common of using debugger is to dip into a code execution, meanwhile sometimes it is really useful to get some signals from the code.
This article tells about the Logging language, a built-in debugging tool of Realaxy ActionScript Editor (RASE). The basic operator of this language extension is trace, just like trace in the pure AS3. Nevertheless, the capabilities of this tool were dramatically redesigned and improved.
Basically, the Logging language has 7 main features that are uncovered in this post:
1. It is built-in and closely integrated with RASE
2. It provides a number of simple and powerful tricks to automate your routine actions, such as:
The Logging language automatically appears in every newly created project of Realaxy Editor as a substitution of basic functionality of ActionScript 3 (it refers to the trace operator only).

For instance, if we’ll create a new Main() class and try to type a new trace expression, the autocomplete menu will show you that it is not really pure AS3.

Note for the curious people: if you remove com.realaxy.actionScript.logging from Module Properties, the same autocomplete menu will look like that:

A trivial logging in AS3 works as follows:
import flash.display.Sprite;
public class Main extends Sprite {
// fields ------------------------------------ /
private var a : int = 42 ;
private var b : String = "All work and no play makes Jack a dull boy" ;
// constructor ------------------------------- /
public function Main( ){
trace("a = ", a, ", b = ", b);
}
}
Looks pretty familiar, isn’t it? Let’s look upon what’s new in the Logging language extension.
Well, let’s describe the sample from the paragraph above with the Logging language:

You can see, there are two alternatives, one with a simple syntax and the other one a little more advanced.
Just for understanding: at the time of the trace completion, your Flash-application and the editor use sockets to communicate with each other. Since Realaxy Editor is an open source software, you can also examine a LoggingUtil class to understand how it works “under the hood”.
The result appears in the Messages window in the lower left corner of the IDE.

As we could see above, the trace values (...) statement allows developers not wasting time on formatting the output. Meanwhile, it’s the thin end of the wedge. Besides the values keyword, the trace syntax allows utilize also many other parameters. For instance, the statement trace package, class, method, args, values(a, myField) will not output only values of a and myField but will also supply a lot of useful debugging information.

The trace statement syntax also provides an easy numbering for the messages (by the way, you can use variables instead of numbers, like on screenshot below):

The output will be the next:

The Logging language offers the 6 different verbosity levels. All of them you can find in autocompletion menu (or on a screenshot below):

Frankly speaking, only three positions from six ones are of a general interest for an end-user: trace, error and warn.

Message with different verbosity appear in different ways on the Messages screen.

It bears mentioning one small but very useful editor’s feature: when you click on any line in the Messages window, you will jump to the trace statement that has thrown that message. For a wonder it’s really hard to find a modern IDE with such a behavior.
![]()
Sometimes it is useful to sort messages, specifically if trace is used many times. It is done as follows: Select the whole trace statement and call the Surround with… menu (Ctrl-Alt-T). Select the log-scope item:
A new log-scope expression will appear. Then enter our new tab’s name:

Well, it’s done. Since now all the messages from the indicated scope will appear automatically in the new tab.

Of course, each scope may contain unlimited number of trace statements.
In other circumstances you may need to emphasize some messages unassumingly. It can be done with a log-indent functionality, which is quite similar to the log-scope mentioned in the previous paragraph. Select any number of trace statements and pick the log-indent item from the same Surround with… menu:

It is easy to imagine the resulting output: the two lines in the middle will be printed with one-symbol indent.
