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:
Debug: Only available if debugging mode is enabled
Info: The normal message
Warn: If you want to warn the user
Fatal: An error which is not occurring because of an C# exception
Error: An error which is occurring because of an C# exception
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.
Plugin Meta: Just set IsDebug to true in the PluginMeta attribute
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
Was this helpful?