Skip to content

Console API ​

Provides output redirection for info, warning, and error messages to the foobar2000 system console.

console ​

console.error ​

Write an error line to the foobar2000 console, prefixed with [WebView][ERROR].

ParameterTypeRequiredDescription
messageanyNoWhat to write. A string is written as it is; any other JSON value as its JSON text. Takes precedence over args.
argsany[]NoValues to write, separated by spaces: strings as they are, other values as their JSON text. Used only when message is absent.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

Provide one of message or args; a call with neither fails with INVALID_PARAMS (message is required).

js
const result = await fb2k.invoke('console.error', { message: 'failed to load artwork' });

console.log ​

Write a line to the foobar2000 console, prefixed with [WebView].

ParameterTypeRequiredDescription
messageanyNoWhat to write. A string is written as it is; any other JSON value as its JSON text. Takes precedence over args.
argsany[]NoValues to write, separated by spaces: strings as they are, other values as their JSON text. Used only when message is absent.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

Provide one of message or args; a call with neither fails with INVALID_PARAMS (message is required).

js
const result = await fb2k.invoke('console.log', { message: 'track started' });

console.warn ​

Write a warning line to the foobar2000 console, prefixed with [WebView][WARN].

ParameterTypeRequiredDescription
messageanyNoWhat to write. A string is written as it is; any other JSON value as its JSON text. Takes precedence over args.
argsany[]NoValues to write, separated by spaces: strings as they are, other values as their JSON text. Used only when message is absent.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

Provide one of message or args; a call with neither fails with INVALID_PARAMS (message is required).

js
const result = await fb2k.invoke('console.warn', { args: ['retry', 3] });

Owner-family behavior and limits ​

  • console.log, console.warn and console.error share their message / args rule with log.write; see Log API.