Console

js.node.console.Console (extern class)

The Console class can be used to create a simple logger with configurable output streams and can be accessed using either require('console').Console or console.Console (or their destructured counterparts):

See: https://nodejs.org/api/console.html#console_class_console

Instance Members

assert(value: Dynamic, message: haxe.extern.Rest): Void

A 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.

See: https://nodejs.org/api/console.html#console_console_assert_value_message
Name Type
value Dynamic
message haxe.extern.Rest

clear(): Void

When stdout is a TTY, calling console.clear() will attempt to clear the TTY. When stdout is not a TTY, this method does nothing.

See: https://nodejs.org/api/console.html#console_console_clear

count(?label: String): Void

Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.

See: https://nodejs.org/api/console.html#console_console_count_label
Name Type Default
label String (optional)

countReset(?label: String): Void

Resets the internal counter specific to label.

See: https://nodejs.org/api/console.html#console_console_countreset_label
Name Type Default
label String (optional)

debug(data: Dynamic, args: haxe.extern.Rest): Void

The console.debug() function is an alias for console.log().

See: https://nodejs.org/api/console.html#console_console_debug_data_args
Name Type
data Dynamic
args haxe.extern.Rest

Uses util.inspect() on obj and prints the resulting string to stdout. This function bypasses any custom inspect() function defined on obj.

See: https://nodejs.org/api/console.html#console_console_dir_obj_options
Name Type Default
obj Dynamic
options Null<js.node.InspectOptionsBase> (optional)

dirxml(data: haxe.extern.Rest): Void

This method calls console.log() passing it the arguments received. This method does not produce any XML formatting.

See: https://nodejs.org/api/console.html#console_console_dirxml_data
Name Type
data haxe.extern.Rest

error(data: Dynamic, args: haxe.extern.Rest): Void

Prints to stderr with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

See: https://nodejs.org/api/console.html#console_console_error_data_args
Name Type
data Dynamic
args haxe.extern.Rest

group(label: haxe.extern.Rest): Void

If one or more labels are provided, those are printed first without the additional indentation.

See: https://nodejs.org/api/console.html#console_console_group_label
Name Type
label haxe.extern.Rest

groupCollapsed(): Void

An alias for console.group().

See: https://nodejs.org/api/console.html#console_console_groupcollapsed

groupEnd(): Void

Decreases indentation of subsequent lines by two spaces.

See: https://nodejs.org/api/console.html#console_console_groupend

info(data: Dynamic, args: haxe.extern.Rest): Void

The console.info() function is an alias for console.log().

See: https://nodejs.org/api/console.html#console_console_info_data_args
Name Type
data Dynamic
args haxe.extern.Rest

log(data: Dynamic, args: haxe.extern.Rest): Void

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

See: https://nodejs.org/api/console.html#console_console_log_data_args
Name Type
data Dynamic
args haxe.extern.Rest

table(tabularData: Dynamic, ?properties: Array<String>): Void

Try to construct a table with the columns of the properties of tabularData (or use properties) and rows of tabularData and log it. Falls back to just logging the argument if it can’t be parsed as tabular.

See: https://nodejs.org/api/console.html#console_console_table_tabulardata_properties
Name Type Default
tabularData Dynamic
properties Array<String> (optional)

time(?label: String): Void

Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique label. Use the same label when calling console.timeEnd() to stop the timer and output the elapsed time in milliseconds to stdout. Timer durations are accurate to the sub-millisecond.

See: https://nodejs.org/api/console.html#console_console_time_label
Name Type Default
label String (optional)

timeEnd(?label: String): Void

Stops a timer that was previously started by calling console.time() and prints the result to stdout:

See: https://nodejs.org/api/console.html#console_console_timeend_label
Name Type Default
label String (optional)

timeLog(?label: String, data: haxe.extern.Rest): Void

For a timer that was previously started by calling console.time(), prints the elapsed time and other data arguments to stdout:

See: https://nodejs.org/api/console.html#console_console_timelog_label_data
Name Type Default
label String (optional)
data haxe.extern.Rest

trace(message: Dynamic, args: haxe.extern.Rest): Void

Prints to stderr the string 'Trace: ', followed by the util.format() formatted message and stack trace to the current position in the code.

See: https://nodejs.org/api/console.html#console_console_trace_message_args
Name Type
message Dynamic
args haxe.extern.Rest

warn(data: Dynamic, args: haxe.extern.Rest): Void

The console.warn() function is an alias for console.error().

See: https://nodejs.org/api/console.html#console_console_warn_data_args
Name Type
data Dynamic
args haxe.extern.Rest

markTimeline(?label: String): Void

This method does not display anything unless used in the inspector. The console.markTimeline() method is the deprecated form of console.timeStamp().

See: https://nodejs.org/api/console.html#console_console_marktimeline_label
Name Type Default
label String (optional)

profile(?label: String): Void

This method does not display anything unless used in the inspector. The console.profile() method starts a JavaScript CPU profile with an optional label until console.profileEnd() is called. The profile is then added to the Profile panel of the inspector.

See: https://nodejs.org/api/console.html#console_console_profile_label
Name Type Default
label String (optional)

profileEnd(?label: String): Void

This method does not display anything unless used in the inspector. Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. See console.profile() for an example.

See: https://nodejs.org/api/console.html#console_console_profileend_label
Name Type Default
label String (optional)

timeStamp(?label: String): Void

This method does not display anything unless used in the inspector. The console.timeStamp() method adds an event with the label 'label' to the Timeline panel of the inspector.

See: https://nodejs.org/api/console.html#console_console_timestamp_label
Name Type Default
label String (optional)

timeline(?label: String): Void

This method does not display anything unless used in the inspector. The console.timeline() method is the deprecated form of console.time().

See: https://nodejs.org/api/console.html#console_console_timeline_label
Name Type Default
label String (optional)

timelineEnd(?label: String): Void

This method does not display anything unless used in the inspector. The console.timelineEnd() method is the deprecated form of console.timeEnd().

See: https://nodejs.org/api/console.html#console_console_timelineend_label
Name Type Default
label String (optional)

new(stdout: js.node.stream.IWritable, ?stderr: js.node.stream.IWritable, ?ignoreerrors: Bool): Void

Creates a new Console with one or two writable stream instances. stdout is a writable stream to print log or info output. stderr is used for warning or error output. If stderr is not provided, stdout is used for stderr.

See: https://nodejs.org/api/console.html#console_new_console_stdout_stderr_ignoreerrors
Name Type Default
stdout js.node.stream.IWritable
stderr js.node.stream.IWritable (optional)
ignoreerrors Bool (optional)

Metadata

Name Parameters
:jsRequire "console", "Console"