Skip to content

Logging

Mike Puskar edited this page Dec 29, 2021 · 2 revisions

IPT.Common contains a static Logging class that standardizes messages sent to the Rage log. Each plugin can register with the logging class to set its log level. Log messages will reference the calling assembly.

Example

var config = new Config();
config.Load();
Logging.Register(Assembly.GetExecutingAssembly(), (LoggingLevel)config.LogLevel.Value);
Logging.Debug("a verbose message, the lowest logging level");
Logging.Info("a standard message, will be sent if LogLevel is INFO or higher");
Logging.Warning("higher than INFO but lower than ERROR");

try
{
    // do something
}
catch (Exception ex)
{
    Logging.Error("you must include the Exception object when calling Error", ex);
}
Clone this wiki locally