Interface IExceptionLogger
A general purpose exception logger. If used from within Web API controllers is possible that HTTP context information is not logged alongside error information. Please use IWebApiExceptionLogger instead.
Namespace: Google.Cloud.Diagnostics.AspNet
Assembly: Google.Cloud.Diagnostics.AspNet.dll
Syntax
public interface IExceptionLogger
Methods
Log(Exception, HttpContext)
Logs an exception that occurred.
Declaration
void Log(Exception exception, HttpContext context = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception to log. Must not be null. |
| System.Web.HttpContext | context | Optional, the current HTTP context. If unset the current context will be retrieved automatically. |
LogAsync(Exception, HttpContext, CancellationToken)
Asynchronously logs an exception that occurred.
Declaration
Task LogAsync(Exception exception, HttpContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The exception to log. Must not be null. |
| System.Web.HttpContext | context | Optional, the current HTTP context. If unset the current context will be retrieved automatically. |
| System.Threading.CancellationToken | cancellationToken | Optional, The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task representing the asynchronous operation. |