[Obsolete("Use Google.Cloud.Diagnostics.Common.LoggingOptions andGoogle.Cloud.Diagnostics.Common.LoggingServiceOptions instead.")]
public sealed class LoggerOptions
Options for a GoogleLogger.
Namespace
Google.Cloud.Diagnostics.AspNetCore3Assembly
Google.Cloud.Diagnostics.AspNetCore3.dll
Properties
BufferOptions
public BufferOptions BufferOptions { get; }
The buffer options for the logger.
Type | Description |
Google.Cloud.Diagnostics.Common.BufferOptions |
Labels
public Dictionary<string, string> Labels { get; }
Custom labels for log entries.
Type | Description |
Dictionary<String, String> |
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 Google.Cloud.Diagnostics.Common.RetryOptions.ExceptionHandling.
LoggerDiagnosticsOutput
public TextWriter LoggerDiagnosticsOutput { get; }
A TextWriter to write diagnostics info about loggers created with these LoggerOptions. Currently the only diagnostics info we provide is the URL where the logs written with these options can be found.
Type | Description |
TextWriter |
LogLevel
public LogLevel LogLevel { get; }
The minimum log level.
Type | Description |
LogLevel |
LogName
public string LogName { get; }
The name for the all logs.
Type | Description |
String |
MonitoredResource
public MonitoredResource MonitoredResource { get; }
The monitored resource. See: https://cloud.google.com/logging/docs/api/v2/resource-list
Type | Description |
MonitoredResource |
RetryOptions
public RetryOptions RetryOptions { get; }
The retry options for the logger.
Type | Description |
Google.Cloud.Diagnostics.Common.RetryOptions |
ServiceName
public string ServiceName { get; }
An identifier of the service, such as the name of the executable or job. May be null. When set, it will be included in the
serviceContext
Type | Description |
String |
Version
public string Version { get; }
A string that represents the version of the service or the source code that logs are written for. When set, it will be included in the
serviceContext
Type | Description |
String |
Methods
Create(LogLevel, String, Dictionary<String, String>, MonitoredResource, BufferOptions, RetryOptions, TextWriter)
public static LoggerOptions Create(LogLevel logLevel = LogLevel.Information, string logName = null, Dictionary<string, string> labels = null, MonitoredResource monitoredResource = null, BufferOptions bufferOptions = null, RetryOptions retryOptions = null, TextWriter loggerDiagnosticsOutput = null)
Create a new instance of LoggerOptions.
Name | Description |
logLevel | LogLevel Optional, the minimum log level. Defaults to Information |
logName | String Optional, the name of the log. Defaults to 'aspnetcore'. |
labels | Dictionary<String, String> Optional, custom labels to be added to log entries.
Keys and values added to |
monitoredResource | MonitoredResource Optional, the monitored resource. The monitored resource will be automatically detected if it is not set and will default to the global resource if the detection fails. See: https://cloud.google.com/logging/docs/api/v2/resource-list |
bufferOptions | Google.Cloud.Diagnostics.Common.BufferOptions Optional, the buffer options. Defaults to a Google.Cloud.Diagnostics.Common.BufferType.Timed |
retryOptions | Google.Cloud.Diagnostics.Common.RetryOptions Optional, the retry options. Defaults to a Google.Cloud.Diagnostics.Common.RetryType.None |
loggerDiagnosticsOutput | TextWriter Optional. If set some logger diagnostics info will be written to the given TextWriter. Currently the only diagnostics info we provide is the URL where the logs written with these options can be found. |
Type | Description |
LoggerOptions |
CreateWithDetectedServiceContext(LogLevel, String, Dictionary<String, String>, MonitoredResource, BufferOptions, RetryOptions, TextWriter)
public static LoggerOptions CreateWithDetectedServiceContext(LogLevel logLevel = LogLevel.Information, string logName = null, Dictionary<string, string> labels = null, MonitoredResource monitoredResource = null, BufferOptions bufferOptions = null, RetryOptions retryOptions = null, TextWriter loggerDiagnosticsOutput = null)
Create a new instance of LoggerOptions with default service context.
If monitoredResource
is provided, the service context will be obtained from it.
Else, if running on GAE, the service context will be obtained from the platform.
Name | Description |
logLevel | LogLevel Optional, the minimum log level. Defaults to Information |
logName | String Optional, the name of the log. Defaults to 'aspnetcore'. |
labels | Dictionary<String, String> Optional, custom labels to be added to log entries.
Keys and values added to |
monitoredResource | MonitoredResource Optional, the monitored resource. The monitored resource will be automatically detected if it is not set and will default to the global resource if the detection fails. See: https://cloud.google.com/logging/docs/api/v2/resource-list |
bufferOptions | Google.Cloud.Diagnostics.Common.BufferOptions Optional, the buffer options. Defaults to a Google.Cloud.Diagnostics.Common.BufferType.Timed |
retryOptions | Google.Cloud.Diagnostics.Common.RetryOptions Optional, the retry options. Defaults to a Google.Cloud.Diagnostics.Common.RetryType.None |
loggerDiagnosticsOutput | TextWriter Optional. If set some logger diagnostics info will be written to the given TextWriter. Currently the only diagnostics info we provide is the URL where the logs written with these options can be found. |
Type | Description |
LoggerOptions |
CreateWithServiceContext(LogLevel, String, Dictionary<String, String>, MonitoredResource, BufferOptions, RetryOptions, TextWriter, String, String)
public static LoggerOptions CreateWithServiceContext(LogLevel logLevel = LogLevel.Information, string logName = null, Dictionary<string, string> labels = null, MonitoredResource monitoredResource = null, BufferOptions bufferOptions = null, RetryOptions retryOptions = null, TextWriter loggerDiagnosticsOutput = null, string serviceName = null, string version = null)
Create a new instance of LoggerOptions.
Name | Description |
logLevel | LogLevel Optional, the minimum log level. Defaults to Information |
logName | String Optional, the name of the log. Defaults to 'aspnetcore'. |
labels | Dictionary<String, String> Optional, custom labels to be added to log entries.
Keys and values added to |
monitoredResource | MonitoredResource Optional, the monitored resource. The monitored resource will be automatically detected if it is not set and will default to the global resource if the detection fails. See: https://cloud.google.com/logging/docs/api/v2/resource-list |
bufferOptions | Google.Cloud.Diagnostics.Common.BufferOptions Optional, the buffer options. Defaults to a Google.Cloud.Diagnostics.Common.BufferType.Timed |
retryOptions | Google.Cloud.Diagnostics.Common.RetryOptions Optional, the retry options. Defaults to a Google.Cloud.Diagnostics.Common.RetryType.None |
loggerDiagnosticsOutput | TextWriter Optional. If set some logger diagnostics info will be written to the given TextWriter. Currently the only diagnostics info we provide is the URL where the logs written with these options can be found. |
serviceName | String A string that represents the version of the service or the source code that logs are written for. When set, it will be included in the
|
version | String A string that represents the version of the service or the source code that logs are written for. When set, it will be included in the
|
Type | Description |
LoggerOptions |