tango.util.log.Trace

License:

BSD style: see license.txt

Version:

Oct 2007: Initial release

Author:

Kris

Synchronized, formatted console output. This can be used in lieu of true logging where appropriate.

Trace exposes this style of usage:

1
2
3
Trace.format ("abc {}", 1);             => abc 1
Trace.format ("abc {}:{}", 1, 2);       => abc 1:2
Trace.format ("abc {1}:{0}", 1, 2);     => abc 2:1

Special character sequences, such as "\n", are written directly to the output without any translation (though an output-filter could be inserted to perform translation as required). Platform-specific newlines are generated instead via the formatln() method, which also flushes the output when configured to do so:

1
Trace.formatln ("hello {}", "world");

Explicitly flushing the output is achieved via a flush() method

1
Trace.format ("hello {}", "world").flush;
SyncPrint Trace [public, static] #
Construct Trace when this module is loaded
global trace instance
class SyncPrint [private] #
Intended for internal use only
this(OutputStream output, bool flush = false) #
Construct a Print instance, tying the provided stream to a layout formatter
SyncPrint format(char[] fmt, ...) [final] #
Layout using the provided formatting specification
SyncPrint formatln(char[] fmt, ...) [final] #
Layout using the provided formatting specification
void flush() [final] #
Flush the output stream
uint sink(char[] s) [private, final] #
Sink for passing to the formatter
SyncPrint memory(void[] mem) [final] #
Print a range of raw memory as a hex dump. Characters in range 0x20..0x7E are printed, all others are shown as dots.
1
2
3
4
000000:  47 49 46 38  39 61 10 00  10 00 80 00  00 48 5D 8C  GIF89a.......H].
000010:  FF FF FF 21  F9 04 01 00  00 01 00 2C  00 00 00 00  ...!.......,....
000020:  10 00 10 00  00 02 11 8C  8F A9 CB ED  0F A3 84 C0  ................
000030:  D4 70 A7 DE  BC FB 8F 14  00 3B                     .p.......;