|
For example, if the programmer logs events to JavaLog, the user may, at run time, decided that he wants to see error events in a pop-up dialog box, warning events written to a file, and informational events on the standard output. Additionally, for each type of event (errors, warnings, notices, traces, or user defined) he may specify a format in which each event should be logged.
The programmer's job is simple:
import grace.log.Log;The resulting program will then produce the following:
...
public void foobar() {
Log.trace("hey!");
}
03/07/99 17:02:48: 13: trace: system.main.Thread1: Test.foobar:54: "hey!"Yes, it's just that simple! Notice that in the preceding call to Log.trace(data), JavaLog printed out the String "MyData" and automatically determined and logged the following: