Skip to content
Piotr Gankiewicz edited this page Sep 18, 2016 · 2 revisions

Logging messages (hooks invocation, watcher checks, errors etc.) is a feature available thanks to the IWardenLogger interface:

public interface IWardenLogger
{
    void Trace(string message);
    void Info(string message);
    void Error(string message, Exception exception = null);
}
  • Trace - logs the message using the Trace log level.
  • Info - - logs the message using the Info log level.
  • Error - - logs the error message and optional exception using the Error log level.

The log level simply defines which messages should be written to the output:

public enum WardenLoggerLevel
{
    Error = 1,
    Info = 2,
    Trace = 3,
    All = 4
}

Configuration:

Logger can be configured using the SetLogger() method available while configuring either the Warden or Warden Manager.

SetLogger(() => new MyLogger());

It is also possible to use the built-in Console Logger:

WithConsoleLogger(minLevel: WardenLoggerLevel.Info, useColors: true);
Clone this wiki locally