Diagnostics
Class for writing debugging messages to the "console"
- Object
- Diagnostics
Remarks
This class contains static methods used to send messages to the insepctor's "console" area. In Release mode, these methods do nothing. To view the inspector console, either press F10 or call Diagnostics.showInspector().
To write lines to the console, use Diagnostics.warn(s), Diagnostics.error(s), or Diagnostics.write(s). To clear the buffer, call Diagnostics.clearBuffer().
Methods
beginTask | Marks the beginning of a timed task with a name. This must be matched by a subsequent call to endTask(). It may be called multiple times during a session, in which case statistics will be accumulated. |
captureSnapshot | Returns a "snapshot" of the current data loaded into the page. |
clearAllTaskStats | Clear all task statistics. |
clearBuffer | Clears the console output in the inspector. |
clearTaskStats | Clears stats for a given task. |
endTask | Marks the end of a timed task that has been given name. This must be matched by a preceding call to beginTask(). It may be called multiple times during a session, in which case statistics will be accumulated. If accum is false or omitted, statistics will be output immediately, and not accumulated. |
error | Writes a line of text to the console, marking it as a error. |
outputAllTaskStats | Output statistics for all available tasks. |
outputTaskStats | Outputs statistics for a given task. These include total time, current time, number of times, min, max, and average. |
restoreSnapshot | Loads a "snapshot" of data previously created with captureSnapshot. |
showInspector | Opens the Inspector window, if the inspector is available. |
warn | Writes a line of text to the console, marking it as a warning |
write | Writes a line of text to the console. |
Diagnostics beginTask static method
Marks the beginning of a timed task with a name. This must
be matched by a subsequent call to endTask(). It may be called multiple times
during a session, in which case statistics will be accumulated.
JavaScript
Diagnostics.beginTask(name)
Diagnostics captureSnapshot static method
Returns a "snapshot" of the current data loaded into the page.
JavaScript
Diagnostics.captureSnapshot()
Remarks
This is used during debugging to capture the data held in DataSets loaded into
a page, as a string. The contents of the snapshot can then be saved to a file,
and retrieved later on using restoreSnapshot().
See Also
Diagnostics clearAllTaskStats static method
Clear all task statistics.
JavaScript
Diagnostics.clearAllTaskStats()
Diagnostics clearBuffer static method
Clears the console output in the inspector.
JavaScript
Diagnostics.clearBuffer()
Diagnostics clearTaskStats static method
Clears stats for a given task.
JavaScript
Diagnostics.clearTaskStats(name)
Diagnostics endTask static method
Marks the end of a timed task that has been given name. This must
be matched by a preceding call to beginTask(). It may be called multiple times
during a session, in which case statistics will be accumulated. If accum is
false or omitted, statistics will be output immediately, and not accumulated.
JavaScript
Diagnostics.endTask(name,accumulate)
Diagnostics error static method
Writes a line of text to the console, marking it as a error.
JavaScript
Diagnostics.error(s)
Remarks
Errors are shown in red in the console.
Example
// writes an error to the debugging console. Diagnostics.error("Unexpected null");
Diagnostics outputAllTaskStats static method
Output statistics for all available tasks.
JavaScript
Diagnostics.outputAllTaskStats()
Diagnostics outputTaskStats static method
Outputs statistics for a given task. These include total time, current time, number of times,
min, max, and average.
JavaScript
Diagnostics.outputTaskStats(name)
Diagnostics restoreSnapshot static method
Loads a "snapshot" of data previously created with captureSnapshot.
JavaScript
Diagnostics.restoreSnapshot(url,dataObj)
Remarks
This is used during debugging to restore capture the data held in DataSets loaded into
a page.
See Also
Diagnostics showInspector static method
Opens the Inspector window, if the inspector is available.
JavaScript
Diagnostics.showInspector()
Diagnostics warn static method
Writes a line of text to the console, marking it as a warning
JavaScript
Diagnostics.warn(s)
Remarks
Warnings are shown in orange in the console.
Example
Diagnostics.warn("I got here"); // writes a warning to the debugging console.
Diagnostics write static method
Writes a line of text to the console.
JavaScript
Diagnostics.write(s)
Example
// writes a message to the debugging console. Diagnostics.write("Initialized page");