Skip to content

fb.log Log File ​

fb.log provides file logging operations (write, read, and clear) targeting the host log file webview_ui.log in the foobar2000 profile directory. To send messages to the foobar2000 console window instead, use fb.console.

clear() ​

Signature: fb.log.clear(): Promise<LogClearResponse>

Clears webview_ui.log. Custom files written through options.file of write() remain intact.

javascript
const result = await fb.log.clear();

read(lines?) ​

Signature: fb.log.read(lines?: number): Promise<LogReadResponse>

ParameterTypeRequiredDescription
linesnumberNoMaximum number of trailing lines to return; defaults to 100

Reads the trailing lines lines of webview_ui.log. The response contains content (concatenated lines joined with \n), lines array, lineCount, and totalLines (total line count of the entire file). If the log file does not exist, it is treated as empty, and lines and totalLines are omitted from the response.

javascript
const res = await fb.log.read(100);
if (res.success === false) throw new Error(res.error);
const { lines } = res;

write(message, options?) ​

Signature: fb.log.write(message: string, options?: LogWriteParams): Promise<LogWriteResponse>

ParameterTypeRequiredDescription
messagestringYesText payload to write. Passing an empty string fails with INVALID_PARAMS
options.levelstringNoLog level identifier, formatted uppercase in square brackets preceding the message; defaults to 'info'
options.appendbooleanNoWrite mode; appends when true, overwrites the entire file content when false. Defaults to true
options.timestampbooleanNoTimestamp toggle; prefixes the entry with local timestamp formatted as [YYYY-MM-DD HH:MM:SS.mmm]. Defaults to true
options.filestringNoAlternative target file within the profile directory: must be a bare filename ending with .log or .txt, excluding reserved Windows device names (such as CON, PRN, NUL). Any non-conforming value is ignored and falls back to writing to webview_ui.log
options.argsJsonValue[]NoReserved parameter: the host parser examines args only when message is omitted; because fb.log.write always provides message, this parameter is ignored

The path field in the response contains the resolved absolute path of the target log file.

javascript
const result = await fb.log.write('Playback started', {
	level: 'info',
	timestamp: true,
});