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.
Namespace
GoogleCloudGoogle.Cloud.DiagnosticsCommonAssembly
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 | |
---|---|
Name | Description |
logger | ILogger |
labels | IEnumerableKeyValuePairstringstring |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
logger | ILogger |
labels | KeyValuePairstringstring |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
logger | ILogger |
labels | IEnumerableKeyValuePairstringstring |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
logger | ILogger |
labels | KeyValuePairstringstring |
Returns | |
---|---|
Type | Description |
ILogger |