Logging

On this page, we will explain you, how to log your plugin with the built in logging system.

The Logger

Every plugin has its own logger. The logger gets created with the plugin id or the plugin name as prefix and can be accessed by the plugin main class.

The logger has 6 logging levels:

  1. Debug: Only available if debugging mode is enabled

  2. Info: The normal message

  3. Warn: If you want to warn the user

  4. Fatal: An error which is not occurring because of an C# exception

  5. Error: An error which is occurring because of an C# exception

  6. Verbose

The logger will automically log the message to the console as well as to a logging file in the logs folder for the given plugin.

String Formatting

The logging system has its own built in string format. Just use the logging methods and pass your arguments. The message than can contain placeholders with curly brackets like {PLACEHOLDER}.

Debug Mode

To enable the debug mode for plugins, you have two ways: Using the logger's setter or the plugin meta.

  1. Plugin Meta: Just set IsDebug to true in the PluginMeta attribute

  2. Logger's Setter: Just call Logger.SetDebug(true/false) to enable or disable the debugging

When the logger is not in debug mode, debug message won't be printed nor saved to the log files.

Last updated