Class EnvironmentNameLogEntryLabelProvider (4.4.0)

public class EnvironmentNameLogEntryLabelProvider : ILogEntryLabelProvider, ILogEntryLabelProvider

A ILogEntryLabelProvider implementation which adds the EnvironmentName to the log entry labels.

Inheritance

Object > EnvironmentNameLogEntryLabelProvider

Namespace

Google.Cloud.Diagnostics.AspNetCore3

Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

Constructors

EnvironmentNameLogEntryLabelProvider(IWebHostEnvironment)

public EnvironmentNameLogEntryLabelProvider(IWebHostEnvironment hostingEnvironment)

Initializes a new instance of the EnvironmentNameLogEntryLabelProvider class.

Parameter
NameDescription
hostingEnvironmentIWebHostEnvironment

The IWebHostEnvironment instance to retrieve the environment name from.

Methods

Invoke(Dictionary<String, String>)

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

Invokes the provider to augment log entry labels.

Parameter
NameDescription
labelsDictionary<String, 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.