Logging
Enable Logging
To enable logging of Loupedeck software, follow these instructions.
Note: Enabling logging might slow down the Loupedeck software considerably. Remember to turn off logging when you don't need it.
Log file location
Log files are located in the "Logs" subdirectory of the Loupedeck data directory:
On Windows it is %LocalAppData%\Loupedeck\Logs
or C:\Users\<user_name>\AppData\Local\Loupedeck\Logs
On macOS, it is ~/.local/share/Loupedeck/Logs
Enabling traces and logs manually
Enabling traces and logs are done by creating empty files with specific names, without the file extension in the Loupedeck data directory (same place where the LoupedeckSettings.ini file is located at):
enablelogs
- enables writing traces to log file; enables alsoenableverbose
.enableverbose
- adds verbose output to traces; multiplies the number of traces; not recommended for the development environment.enabletraces
- enables traces.
Note: Filename should not include a file extension. For example, enabletraces.txt will not work.
Enabling logs with Loupedeck Troubleshooter
Note: This feature is available only on Windows.
Right-click on the Loupedeck icon in the Windows tray and then select the "Troubleshooter" menu item.
Or, run this application: C:\Program Files (x86)\Loupedeck\Loupedeck2\LoupeDiag.exe
.
After that, click the "Start logs collection" button.
To stop logging, click the "Stop logs collection" button.
Plugin Logging
New in version 5.6.
Loupedeck provides logging possibilities also for plugins. The log messages from a plugin are written both to the Loupedeck application log file (when enabled) and to a plugin-specific log file. The plugin logging is always enabled, even if the Loupedeck application logging is disabled. The plugin log file is located in the "Logs\plugin_logs" subdirectory of the Loupedeck data directory.
Note: Because the plugin logging is supported only by Loupedeck version 5.6 and newer, you must add the following line to the plugin settings in the LoupedeckPackage.yaml file of your plugin:
Setting up logging for new plugins
For a new plugin, the easiest way to take the plugin logging into use is to generate the plugin project with the Loupedeck Plugin Tool (see Creating the project files for the plugin). The Plugin Tool version must be 5.6 or newer. The generated skeleton project contains the enabler code for plugin logging and an example of how to log messages from the plugin code.
Setting up logging for existing plugins
The Loupedeck demo plugin contains an example of plugin logging: DemoPlugin/Step06.
The PluginLog
class provides helper methods to log messages easily everywhere in the plugin code. You can find the source code here: PluginLog.cs
The following log levels are supported by the plugin logs: Verbose, Info, Warning, and Error. For each log level, the PluginLog
class has a method for logging
- a message only (a text string), and
- a message and an exception.
For instance, the following methods can be used for logging with the Info log level:
public static void Info(String text) => PluginLog._pluginLogFile?.Info(text);
public static void Info(Exception ex, String text) => PluginLog._pluginLogFile?.Info(ex, text);
For an existing plugin, you can take the plugin logging into use as follows:
-
Download the PluginLog.cs file and include it in your plugin project.
-
In the
PluginLog.cs
file, change the namespace to the same one that your plugin project uses: -
Initialize the
PluginLog
class in the constructor of your plugin class (replace the plugin class nameDemoPlugin
with your plugin class):
After this, you can log messages in your plugin code: