# Class LabelProviderExtensions (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.LabelProviderExtensions)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/4.3.1/Google.Cloud.Diagnostics.AspNetCore.LabelProviderExtensions)

    [Obsolete("Use equivalent extension methods defined in Google.Cloud.Diagnostics.Common.LoggingExtensions instead.")]
    public static class LabelProviderExtensions

Provides extension methods to register [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementations.

## Inheritance

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

## 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)

## 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

## Methods

### AddLogEntryLabelProvider\<T\>(IServiceCollection)

    [Obsolete("Use equivalent extension method defined in Google.Cloud.Diagnostics.Common.LoggingExtensions instead.")]
    public static IServiceCollection AddLogEntryLabelProvider<T>(this IServiceCollection serivces)
        where T : class, ILogEntryLabelProvider

Adds a [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) of type `T` to the service collection instance.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `serivces` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` | The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` | The type of the [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation. |

### AddLogEntryLabelProvider\<T\>(IServiceCollection, T)

    [Obsolete("Use equivalent extension method defined in Google.Cloud.Diagnostics.Common.LoggingExtensions instead.")]
    public static IServiceCollection AddLogEntryLabelProvider<T>(this IServiceCollection serivces, T instance)
        where T : class, ILogEntryLabelProvider

Adds a [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) of type `T` to the service collection instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `serivces` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |
| `instance` | `T` The instance of `T`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` | The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` | The type of the [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation. |

### AddLogEntryLabelProvider\<T\>(IServiceCollection, Func\<IServiceProvider, T\>)

    [Obsolete("Use equivalent extension method defined in Google.Cloud.Diagnostics.Common.LoggingExtensions instead.")]
    public static IServiceCollection AddLogEntryLabelProvider<T>(this IServiceCollection serivces, Func<IServiceProvider, T> implementationFactory)
        where T : class, ILogEntryLabelProvider

Adds a [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) of type `T` to the service collection instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `serivces` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |
| `implementationFactory` | `https://learn.microsoft.com/dotnet/api/system.func-2<https://learn.microsoft.com/dotnet/api/system.iserviceprovider, T>` The factory that creates the service. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` | The [IServiceCollection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) instance. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` | The type of the [ILogEntryLabelProvider](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.ILogEntryLabelProvider) implementation. |