Skip to content

Logging

Note: Enabling logging might slow down the Logi Plugin Service 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 Logi Plugin Service data directory:

  • On Windows it is C:\Users\<user_name>\AppData\Local\Logi\LogiPluginService\Logs
  • On macOS, it is ~/Library/Application Support/Logi/LogiPluginService/Logs

Enabling traces and logs

Enabling traces and logs are done by creating empty files with specific names, without the file extension in the Logi Plugin Service data directory (same place where the LoupedeckSettings.ini file is located at):

  • enablelogs - enables writing traces to log file

Note: Filename should not include a file extension. For example, enablelogs.txt will not work.

Plugin Logging

New in version 5.6.

Logi Plugin Service provides logging possibilities also for plugins. The log messages from a plugin are written both to the Logi Plugin Service log file (when enabled) and to a plugin-specific log file. The plugin logging is always enabled, even if the Service logging is disabled. The plugin log file is located in the "Logs\plugin_logs" subdirectory of the Logi Plugin Service data directory.

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 Logi 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 demo plugin contains an example of plugin logging: DemoPlugin.

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:

  1. Download the PluginLog.cs file and include it in your plugin project.

  2. In the PluginLog.cs file, change the namespace to the same one that your plugin project uses:

    namespace Loupedeck.DemoPlugin
    
  3. Initialize the PluginLog class in the constructor of your plugin class (replace the plugin class name DemoPlugin with your plugin class):

    public DemoPlugin() => PluginLog.Init(this.Log);
    

After this, you can log messages in your plugin code:

PluginLog.Info("Counter was reset");