Google.Cloud.Diagnostics.AspNetCore3 - Class HttpLogEntryLabelProvider (5.2.0)

public abstract class HttpLogEntryLabelProvider : ILogEntryLabelProvider

Reference documentation and code samples for the Google.Cloud.Diagnostics.AspNetCore3 class HttpLogEntryLabelProvider.

Base class for Google.Cloud.Diagnostics.Common.ILogEntryLabelProvider implementations which needs an HttpContext instance.

Inheritance

object > HttpLogEntryLabelProvider

Implements

Google.Cloud.Diagnostics.Common.ILogEntryLabelProvider

Namespace

Google.Cloud.Diagnostics.AspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Constructors

HttpLogEntryLabelProvider(IHttpContextAccessor)

protected HttpLogEntryLabelProvider(IHttpContextAccessor httpContextAccessor)

Initializes the HttpLogEntryLabelProvider base class.

Parameter
Name Description
httpContextAccessor IHttpContextAccessor

The IHttpContextAccessor instance with the HttpContext.

Methods

Invoke(Dictionary<string, string>)

public void Invoke(Dictionary<string, string> labels)

Invokes the provider to augment log entry labels.

Parameter
Name Description
labels Dictionarystringstring

A dictionary of log entry labels. Keys and values added to labels should not be null. If they are, an exception will be throw when attempting to log an entry. The entry won't be logged and the exception will be propagated depending on the value of Google.Cloud.Diagnostics.Common.RetryOptions.ExceptionHandling.

InvokeCore(Dictionary<string, string>, HttpContext)

protected abstract void InvokeCore(Dictionary<string, string> labels, HttpContext httpContext)

In a derived class, invokes the core logic of the Google.Cloud.Diagnostics.Common.ILogEntryLabelProvider using the HttpContext instance.

Parameters
Name Description
labels Dictionarystringstring

The log entry labels to augment.

httpContext HttpContext

The HttpContext instance.