Name

Debug — The Laszlo debugger

Synopsis

JavaScript: Debug
Type: Object
Access: public
Build Flags: debug
Topic: LZX.Debugging

Description

Automatically created when an application is compiled in debug mode (requested by either using the canvas (LzCanvas)debug='true' attribute or by loading the application using the ?debug=true option).

Details

Static Properties (5)

atFreshLine
static public var atFreshLine = true;
Generic low-level output
atPrompt
static public var atPrompt = false;
printLength
static public var printLength = 1024;
Debug.write will truncate the printed representation of any object whose length is greater than Debug.printLength (default value 1024). See also: Debug.inspect.printLength
printPretty
static public var printPretty = true;
Debug.write will print 'pretty' versions of objects if this is true (default is true).
showInternalProperties
static public var showInternalProperties = false;
Debug.inspect will show internal properties if this is true (default is false).

Static Methods (17)

backtrace()
static public function backtrace(skip);
Snapshot the current call stack into a LzBacktrace object which can be printed or inspected Only available if lfc is compiled with --option debugBacktrace=true
debug()
static public function debug(control, args);
Display an debug on the console Takes a format control and any number of arguments. Cf., Debug.format
error()
static public function error(control, args);
Display an error on the console Takes a format control and any number of arguments. Cf., Debug.format
format()
static public function format(control : string, args);
Formatted output. Formats its arguments using formatToString().
formatToString()
static public function formatToString(control : string, args) : LzMessage;
Formatted output to string Formats its arguments according to the control string The standard printf conversions are accepted, with the exception of `a`, `n`, and `p`. `e`, `f`, and `g` conversions are accepted but equivalent to `f`. The `h` and `l` length modifiers are accepted but ignored. No errors are signalled for invalid format controls or insufficient arguments. There is an additional format specifier `w` that formats the argument as if by `Debug.__String` with the 'pretty' option and creates a 'hotlink' so the object can be inspected. If alternate format is requested (#), `w` uses the full `Debug.__String` format used by write(). `%w` format obeys printLength. If a precision is specified, that is used as printLength.
freshLine()
static public function freshLine();
Puts the typeout on a fresh line
freshPrompt()
static public function freshPrompt();
Emit a prompt if not at one
info()
static public function info(control, args);
Display an info on the console Takes a format control and any number of arguments. Cf., Debug.format
inspect()
static public function inspect(obj : Object, reserved : Null);
Display the properties of an object on the debug console. Debug.inspect displays each of the properties of its argument object using Debug.write. Properties that have complex values (or long representations that are abbreviated) are displayed as links. Clicking on the link will invoke Debug.inspect on that object.
monitor()
static public function monitor();
pad()
static public function pad(str, len : Number, dec : Number, pad : String, sign : String, radix : Number, force : Boolean);
pad or trim a string to a specified length
trace()
static public function trace(who : Object, what : String);
Trace a method of an object. Will trace the named method of the object and print a message to the Debug console each time it is called or returned from. When called, the message will give a timestamp, the name of the function and the arguments it was called with. When returned from, the message will give the name of the function and the value it returned (if any). If backtraces are enabled, inspecting the message will reveal the call chain that caused the modification.
unmonitor()
static public function unmonitor();
untrace()
static public function untrace(who : Object, what : String);
Stop tracing a method of an object.
versionInfo()
static public function versionInfo();
Display version info
warn()
static public function warn(control, args);
Display a warning on the console Takes a format control and any number of arguments. Cf., Debug.format
write()
static public function write();
Display one or more objects on the debug console. Note: format() allows more control over displaying multiple objects. Use it instead of Debug.write. Debug.write displays objects on the debug console in an informative format. Simple objects are represented as themselves. Printed Complex objects are represented by their type and a concise description. Long representations (and long Strings) are abbreviated if they are longer than printLength. Complex objects and abbreviated objects presented as links. Clicking on the link will invoke inspect() on the object, giving more detail.

JavaScript Synopsis

public var Debug = { ... };