Class HttpLogEntryLabelProvider (4.4.0)

public abstract class HttpLogEntryLabelProvider : ILogEntryLabelProvider, ILogEntryLabelProvider

Base class for ILogEntryLabelProvider implementations which needs an Microsoft.AspNetCore.Http.HttpContext instance.

Inheritance

System.Object > HttpLogEntryLabelProvider

Namespace

Google.Cloud.Diagnostics.AspNetCore

Assembly

Google.Cloud.Diagnostics.AspNetCore.dll

Constructors

HttpLogEntryLabelProvider(IHttpContextAccessor)

protected HttpLogEntryLabelProvider(IHttpContextAccessor httpContextAccessor)

Initializes the HttpLogEntryLabelProvider base class.

Parameter
Name Description
httpContextAccessor Microsoft.AspNetCore.Http.IHttpContextAccessor

The Microsoft.AspNetCore.Http.IHttpContextAccessor instance with the Microsoft.AspNetCore.Http.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 System.Collections.Generic.Dictionary<System.String, System.String>

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 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 ILogEntryLabelProvider using the Microsoft.AspNetCore.Http.HttpContext instance.

Parameters
Name Description
labels System.Collections.Generic.Dictionary<System.String, System.String>

The log entry labels to augment.

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext instance.