# Class HttpLogEntryLabelProvider (4.4.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [4.4.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.HttpLogEntryLabelProvider)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/4.3.1/Google.Cloud.Diagnostics.AspNetCore.HttpLogEntryLabelProvider)

    public abstract class HttpLogEntryLabelProvider : ILogEntryLabelProvider, ILogEntryLabelProvider

Base class for [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementations which needs an [HttpContext](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext) instance.

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) \> HttpLogEntryLabelProvider

## Implements

[ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider), [ILogEntryLabelProvider](https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ILogEntryLabelProvider.html)

## Inherited Members

[Object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode#system-object-gethashcode) [Object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype#system-object-gettype) [Object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone#system-object-memberwiseclone) [Object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring#system-object-tostring)

## Derived Types

[ClientIpLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ClientIpLogEntryLabelProvider) [TraceIdLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.TraceIdLogEntryLabelProvider) [UserLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.UserLogEntryLabelProvider)

## Namespace

[Google.Cloud.Diagnostics.AspNetCore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore)

## Assembly

Google.Cloud.Diagnostics.AspNetCore.dll

## Constructors

### HttpLogEntryLabelProvider(IHttpContextAccessor)

    protected HttpLogEntryLabelProvider(IHttpContextAccessor httpContextAccessor)

Initializes the [HttpLogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.HttpLogEntryLabelProvider) base class.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpContextAccessor` | `https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.ihttpcontextaccessor` The [IHttpContextAccessor](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.ihttpcontextaccessor) instance with the [HttpContext](https://learn.microsoft.com/dotnet/api/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` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2<https://learn.microsoft.com/dotnet/api/system.string, https://learn.microsoft.com/dotnet/api/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](https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions.html#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 [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) using the [HttpContext](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext) instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `labels` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2<https://learn.microsoft.com/dotnet/api/system.string, https://learn.microsoft.com/dotnet/api/system.string>` The log entry labels to augment. |
| `httpContext` | `https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext` The [HttpContext](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext) instance. |