DiagnosticsLogger

Logger that provides some extra diagnosis information.

Inherits: Logger

Description

The DiagnosticsLogger class allow you to define a logger that provides some extra diagnosis information.

Instance methods

Write

Writes a log message to the logger destination(s).

public override void Write(LogLevel level, IContext context, Exception error, string message)

  • level: LogLevel - log level.
  • context: IContext - (optional) a context to trace execution through a call chain.
  • error: Exception - error object associated with this message.
  • message: string - human-readable message to log.

Examples

var logger = new DiagnosticsLogger();
logger.Level = LogLevel.Debug;

logger.Error("123", ex, "Error occured: %s", ex.Message);
logger.Debug("123", "Everything is OK.");

See also