Google.Cloud.Diagnostics.Common - Class ILoggerExtensions (5.1.0)

public static class ILoggerExtensions

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class ILoggerExtensions.

Extensions for ILogger to allow augmenting the logged information with contextual data. GoogleLogger" will add the information to the LogEntry that is sent to Google Cloud Logging. For the consumption of other loggers, the information will be included in newly created scopes at the moment of logging, in a format that all loggers should understand.

Inheritance

object > ILoggerExtensions

Namespace

GoogleCloudGoogle.Cloud.DiagnosticsCommon

Assembly

Google.Cloud.Diagnostics.Common.dll

Methods

WithAddedLabels(ILogger, IEnumerable<KeyValuePair<string, string>>)

public static ILogger WithAddedLabels(this ILogger logger, IEnumerable<KeyValuePair<string, string>> labels)

Adds labels to the returned logger that may be included with every subsequent log. How this information is included will depend on the actual logger. GoogleLogger" will include this information in Labels. For the consumption of other loggers, the information will be included in newly created scopes at the moment of logging, in a format that all loggers should understand.

If logger had already been augmented with labels, labels will be added to the existing ones on the returned ILogger

Parameters
NameDescription
loggerILogger
labelsIEnumerableKeyValuePairstringstring
Returns
TypeDescription
ILogger

WithAddedLabels(ILogger, params KeyValuePair<string, string>[])

public static ILogger WithAddedLabels(this ILogger logger, params KeyValuePair<string, string>[] labels)

Adds labels to the returned logger that may be included with every subsequent log. How this information is included will depend on the actual logger. GoogleLogger" will include this information in Labels. For the consumption of other loggers, the information will be included in newly created scopes at the moment of logging, in a format that all loggers should understand.

If logger had already been augmented with labels, labels will be added to the existing ones on the returned ILogger

Parameters
NameDescription
loggerILogger
labelsKeyValuePairstringstring
Returns
TypeDescription
ILogger

WithLabels(ILogger, IEnumerable<KeyValuePair<string, string>>)

public static ILogger WithLabels(this ILogger logger, IEnumerable<KeyValuePair<string, string>> labels)

Adds labels to the returned logger that may be included with every subsequent log. How this information is included will depend on the actual logger. GoogleLogger" will include this information in Labels. For the consumption of other loggers, the information will be included in newly created scopes at the moment of logging, in a format that all loggers should understand.

If logger had already been augmented with labels, the old labels will be replaced by the new ones on the returned ILogger.

Parameters
NameDescription
loggerILogger
labelsIEnumerableKeyValuePairstringstring
Returns
TypeDescription
ILogger

WithLabels(ILogger, params KeyValuePair<string, string>[])

public static ILogger WithLabels(this ILogger logger, params KeyValuePair<string, string>[] labels)

Adds labels to the returned logger that may be included with every subsequent log. How this information is included will depend on the actual logger. GoogleLogger" will include this information in Labels. For the consumption of other loggers, the information will be included in newly created scopes at the moment of logging, in a format that all loggers should understand.

If logger had already been augmented with labels, the old labels will be replaced by the new ones on the returned ILogger.

Parameters
NameDescription
loggerILogger
labelsKeyValuePairstringstring
Returns
TypeDescription
ILogger