Class ILoggerExtensions (4.3.1)

public static 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

Google.Cloud.Diagnostics.Common

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
labelsIEnumerable<KeyValuePair<String, String>>
Returns
TypeDescription
ILogger

WithAddedLabels(ILogger, 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
labelsKeyValuePair<String, String>[]
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
labelsIEnumerable<KeyValuePair<String, String>>
Returns
TypeDescription
ILogger

WithLabels(ILogger, 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
labelsKeyValuePair<String, String>[]
Returns
TypeDescription
ILogger