You are reading 12.7.0. See this page in 13.4.1.
Global.Console
Console logging facilities.
The toplevel console support is intended to supplement Titanium.API
and make it easier for developers to port existing javascript code
(especially CommonJS modules) to Titanium.
Note that console does not currently implement the complete
Console specification.
See the following supported methods for details and submit a pull request to add more!
Methods 15
assert
since 9.1.0A simple assertion test that verifies whether value is truthy. If it is not, Assertion failed is logged. If provided, the error message is formatted using util.format() by passing along all message arguments. The output is used as the error message.
| Parameters | Type | Description |
|---|---|---|
| value? | any | The value tested for being truthy. |
| message? | any | All arguments besides value are used as error message. |
count
since 9.1.0Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.
| Parameters | Type | Description |
|---|---|---|
| label? | String | The display label for the counter |
countReset
since 9.1.0Resets the internal counter specific to label.
| Parameters | Type | Description |
|---|---|---|
| label? | String | The display label for the counter |
Log a message at the debug level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |
Log a message at the error level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |
group
since 9.1.0Increases indentation of subsequent lines by spaces for groupIndentation length.
| Parameters | Type | Description |
|---|---|---|
| label? | any | Labels to print before indentation (if provided) |
groupCollapsed
since 9.1.0Alias for group()
| Parameters | Type | Description |
|---|---|---|
| label? | any | Labels to print before indentation (if provided) |
groupEnd
since 9.1.0Decreases indentation of subsequent lines by spaces for groupIndentation length.
Log a message at the info level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |
Log a message at the info level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
Note that this method has different behavior from Titanium.API.log, which can take multiple arguments, but in doing so interprets the first argument as a custom log level.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |
time
since 7.3.0Start a timer to track duration of an operation.
Begin a timer that can be used to track the duration of an operation. If no label is passed to the function it will default to "default". If a label already exists then the existing label will not be overwritten and a warning will be logged to the console.
| Parameters | Type | Description |
|---|---|---|
| label? | String | The label to track the timer by |
timeEnd
since 7.3.0Stop a timer that was previously started.
Stop a timer that was started by calling console.time, and output the time since the timer was begun to the console in milliseconds. If no timer exists a warning will be logged to the console.
| Parameters | Type | Description |
|---|---|---|
| label? | String | The label to track the timer by |
timeLog
since 7.5.0Log duration taken so far for an operation.
Output the time since a timer was started by calling
console.time to the console, as well as any
other data arguments provided. To log extra data a label must
be provided. If no timer exists a warning will be logged to the
console.
| Parameters | Type | Description |
|---|---|---|
| label? | String | The label to track the timer by |
| data? | any | Extra log data to be provided when logging, can be a single argument or any number of arguments. |
trace
since 9.1.0Log a message at the trace level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |
Log a message at the warn level.
The message to log can either be a single argument, or any number of arguments, which will be converted to strings and then concatenated together with a space character.
| Parameters | Type | Description |
|---|---|---|
| message | any | The message(s) to log. |