Table of Contents

Method WriteException

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

WriteException(ILogWriter, Exception)

Writes detailed information about the specified exception to the log, including its type, message, and stack trace.

public static ILogWriter WriteException(this ILogWriter writer, Exception ex)

Parameters

writer ILogWriter

The log writer to which the exception details will be written. Cannot be null.

ex Exception

The exception whose details are to be logged. Cannot be null.

Returns

ILogWriter

The same ILogWriter instance that was provided, to support method chaining.

Remarks

This method writes the exception details within a dedicated section in the log. If the exception's stack trace is null, an empty string is written in its place.

WriteException(ILogWriter, string, Exception)

Writes detailed information about an exception, including its type, message, and stack trace, to the log writer as a formatted section.

public static ILogWriter WriteException(this ILogWriter writer, string message, Exception ex)

Parameters

writer ILogWriter

The log writer to which the exception details are written. Cannot be null.

message string

A descriptive message providing context for the exception.

ex Exception

The exception to log. Cannot be null.

Returns

ILogWriter

The same ILogWriter instance that was provided, to support method chaining.

Remarks

The exception details are written as a distinct section in the log output. This method is intended to standardize exception logging and improve log readability.