Skip to main content

Log from a plugin

BetaThe plugin SDK and these pages are new. They change with each release, as developers use them and tell us what works.View as Markdown

Write the events that matter in your plugin to the Volumio log, and read them while you test. The log is how you and Volumio's support find out why a plugin failed on a user's device.

Write a log line​

The template keeps Volumio's logger as this.logger. Start each line with the plugin's id, so you can find your lines among the others. deploy shows only the lines that name the plugin, and every warning and error:

index.js
this.logger.info('hello_volumio: connected to the service');
this.logger.error(`hello_volumio: login failed: ${error.message}`);

The logger has four levels:

LevelUse it forExample
infoA normal eventThe plugin started, the settings were saved
warnA problem the plugin worked aroundAn optional request failed
errorA failureA daemon did not start, a login failed
debugDetail you need only while you developEach request and its answer

Volumio's logger is winston.

Keep the log useful​

  • Log events, not every step. A busy log hides the line that matters and costs processor time on small devices.
  • Never log a password, a token or anything else the user typed as a secret.
  • Never use console.log. It bypasses the Volumio logger, and volumio-plugin check reports it as G2.js.console-log.

Read the log​

Follow the device's log from your computer while you use the plugin:

npx --package=@volumio/plugin-sdk volumio-plugin logs 192.168.1.20

It runs until you press Ctrl+C. Add --seconds 30 to stop after 30 seconds. logs needs Node.js 22 or later.

volumio-plugin deploy also prints the lines the device logged about the plugin while it started. See Test on a Volumio device.

Was this page helpful?