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

public interface IExceptionLogger

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

A generic exception logger.

Namespace

Google.Cloud.Diagnostics.AspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Methods

Log(Exception, HttpContext)

void Log(Exception exception, HttpContext context = null)

Logs an exception that occurred.

Parameters
Name Description
exception Exception

The exception to log. Must not be null.

context HttpContext

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
Name Description
exception Exception

The exception to log. Must not be null.

context HttpContext

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

cancellationToken CancellationToken

Optional, The token to monitor for cancellation requests.

Returns
Type Description
Task

A task representing the asynchronous operation.