DiagnosticsLogger

Logger that provides some extra diagnosis information.

Inherits: Logger

Description

The DiagnosticsLogger class allows 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, string correlation_id, Exception error, string message)

  • level: LogLevel - log level.
  • correlation_id: string - (optional) transaction id used to trace execution through the 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