Google.Cloud.Diagnostics.AspNetCore3 - Interface IExceptionLogger (5.1.0)

public interface IExceptionLogger

Reference documentation and code samples for the Google.Cloud.Diagnostics.AspNetCore3 interface IExceptionLogger.

A generic exception logger.

Namespace

GoogleCloudGoogle.Cloud.DiagnosticsAspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Methods

Log(Exception, HttpContext)

void Log(Exception exception, HttpContext context = null)

Logs an exception that occurred.

Parameters
NameDescription
exceptionException

The exception to log. Must not be null.

contextHttpContext

Optional, the current HTTP context. If unset the current context will be retrieved automatically.

LogAsync(Exception, HttpContext, CancellationToken)

Task LogAsync(Exception exception, HttpContext context = null, CancellationToken cancellationToken = default)

Asynchronously logs an exception that occurred.

Parameters
NameDescription
exceptionException

The exception to log. Must not be null.

contextHttpContext

Optional, the current HTTP context. If unset the current context will be retrieved automatically.

cancellationTokenCancellationToken

Optional, The token to monitor for cancellation requests.

Returns
TypeDescription
Task

A task representing the asynchronous operation.