interface Console
The Max-console-backed console object exposed by the v8 runtime. Output is routed to the Max console: log, info, and debug use normal post rows, warn uses warning rows, and error, assert, and trace use error rows.
Formatting is a pragmatic subset: string joining, Error stack/message rendering, JSON-ish object rendering with a circular fallback, and the %s, %d, %i, %f, %j, %o, %O, and %% format tokens. Full Node util.inspect, console.table, grouping, profiling, and configurable output streams are not implemented.
In the legacy [js] / [jsui] (SpiderMonkey) objects, use post() and error() instead.
Index
Methods
- assert(condition, data)
- count(label)
- countReset(label)
- debug(data)
- error(data)
- info(data)
- log(data)
- time(label)
- timeEnd(label)
- timeLog(label, data)
- trace(data)
- warn(data)
assert(condition, data)
If condition is falsy, prints the remaining arguments using Max error rows. If condition is truthy, does nothing.
assert(condition?: boolean, ...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| optional condition | boolean | the assertion to test |
| data | any[] | values to format and print when the assertion fails |
count(label)
Increments and prints a counter for the given label.
count(label?: string): void;
| Name | Type | Description |
|---|---|---|
| optional label | string | the counter label (default "default") |
countReset(label)
Resets the counter for the given label.
countReset(label?: string): void;
| Name | Type | Description |
|---|---|---|
| optional label | string | the counter label (default "default") |
debug(data)
Prints a debug message using normal Max console rows.
debug(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | values to format and print |
error(data)
Prints an error using Max error rows.
error(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | values to format and print |
info(data)
Prints an informational message. Alias of Console.log() routing to normal Max console rows.
info(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | values to format and print |
log(data)
Prints a message using normal Max console rows.
log(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | values to format and print |
time(label)
Starts a timer under the given label.
time(label?: string): void;
| Name | Type | Description |
|---|---|---|
| optional label | string | the timer label (default "default") |
timeEnd(label)
Stops the timer for the given label and prints the elapsed time.
timeEnd(label?: string): void;
| Name | Type | Description |
|---|---|---|
| optional label | string | the timer label (default "default") |
timeLog(label, data)
Prints the elapsed time for the given label without stopping the timer.
timeLog(label?: string, ...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| optional label | string | the timer label (default "default") |
| data | any[] | additional values to print alongside the elapsed time |
trace(data)
Prints a stack trace using Max error rows.
trace(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | optional values to format and print with the trace |
warn(data)
Prints a warning using Max warning rows.
warn(...data: any[]): void;
| Name | Type | Description |
|---|---|---|
| data | any[] | values to format and print |