Send to trace log

Command group Flag affected Reversible Execute on client Platform(s)
Debugger NO NO YES All

Syntax

Send to trace log  ([Diagnostic message] [,Always log] [,Start diagnostic logging] [,Stop diagnostic logging]) text

Options

Diagnostic message If specified, the message will only be added to the trace log, if the trace log has been set to log diagnostic messages
Always log If specified, always log the message even if $nodebug is true for the library or the local debugger is disabled (this option is ignored for a diagnostic message)
Start diagnostic logging If specified, the command switches on the Log Diagnostic Messages trace log option, before logging the message if the other command options allow. Also, if specified with an empty message to log, the command does not log an empty line
Stop diagnostic logging If specified, the command switches off the Log Diagnostic Messages trace log option, after logging the message if the other command options allow. Also, if specified with an empty message to log, the command does not log an empty line

Description

This command sends a specified line of text to the trace log. The text can contain square bracket notation. You can use text styles (generated using the style() function inside square brackets) to (for example) apply colors to sections of the logged text when it is displayed in the trace log panel in the browser or the trace log window; such styles are stripped when writing the trace log line to the text log file in the logs folder. The trace log renders the text styles if the entry traceLogUsesStyles in the defaults section of config.json is set to true. Note that if you use styles other than kEscColor and kEscStyle, these styles are ignored when copying selected trace log lines to the clipboard as HTML.

For JavaScript client-executed methods, this command sends the text to the JavaScript console (provided it is available). In this case, text styles are not supported.

Example

# send messages to the trace log
Open trace log (Clear trace log )
Send to trace log Current task is [$ctask().$name]
Send to trace log Current class is [$cclass().$name]
For lCount from 1 to 10 step 1
   Send to trace log Value lCount is [lCount]
End For
Send to trace log End of For Loop