Docs menu

dash.log

Published

Write a line to the console in the pane editor. Use it to follow what a pane does while you build it.

dash.log(...args: unknown[]): void

Example

dash.log('started with', dash.props);

try {
  const res = await dash.fetch('https://api.github.com/zen');
  dash.log('status', res.status);
} catch (err) {
  dash.log('fetch failed:', err);
}

Where the output goes

  • In the editor, each call becomes one line in the console panel under the code, next to uncaught errors and a line for every dash.fetch. The console has a filter (all, logs, errors, network) and a Clear button, and keeps the newest 500 lines.
  • On a canvas, dash.log output is dropped. To see what a placed pane does, run it in the editor’s preview or write to the pane’s own page.
  • console.log inside a pane writes to the browser’s developer tools for the pane’s frame, not to the editor console.

How values are shown

Arguments are joined with spaces on one line.

Argument Shown as
A string The text as it is.
A number, boolean, object, array JSON.
An Error or DashError Its name and message, for example DashError: invalid event name. The stack is not shown.
undefined undefined
A function, symbol or BigInt Its String() form.
A value with no JSON form Its type, for example [object Object] for an object that refers to itself.

Limits

  • A call can carry about 15.5 KB of arguments, measured as JSON. A longer call is shown as one string: the first 4,096 characters of that JSON, followed by … (truncated).
  • A pane can write 50 lines a second. Lines past that are dropped without an error.

dash.log returns nothing and never throws.