gossamer/console
Access to the runtime’s debugging console — log, warn, error, groups, counters, timers, and assertions.
See console on MDN.
Values
pub fn count(label: String) -> Nil
Logs the number of times count has been called with
label. Pair with count_reset to reset the
counter.
pub fn dir(item: a) -> Nil
Displays an interactive listing of the properties of item. Most
useful when the runtime renders an inspectable tree (browsers,
Node REPL).
pub fn dirxml(item: a) -> Nil
Displays an interactive tree of item’s descendant elements when
item is a markup element, falling back to a property listing like
dir otherwise.
pub fn group(label: String) -> Nil
Starts a new inline group titled label. Subsequent console output
is indented under the group until group_end is
called.
pub fn group_collapsed(label: String) -> Nil
Like group, but the group is collapsed by default.
pub fn group_end() -> Nil
Exits the current inline group started by group or
group_collapsed.
pub fn log(data: a) -> Nil
Outputs data to the console at the log log level — the
general-purpose logging entry point.
pub fn log_if_false(that condition: Bool, log data: a) -> Nil
Logs data as an error if condition is False. A no-op when the
condition holds. Equivalent to JavaScript’s console.assert.
pub fn table(data: a) -> Nil
Displays data as a table. The runtime renders the structure as
rows and columns when it can; otherwise falls back to a regular
log.
pub fn time(label: String) -> Nil
pub fn time_end(label: String) -> Nil
Stops the timer identified by label and logs the elapsed time.
pub fn time_log(label: String) -> Nil
Logs the current elapsed time for the timer identified by label
without stopping it.