public sealed class GoogleLogger : ILoggerReference documentation and code samples for the Google.Cloud.Diagnostics.Common class GoogleLogger.
ILogger for Google Cloud Logging.
Implements
ILoggerNamespace
Google.Cloud.Diagnostics.CommonAssembly
Google.Cloud.Diagnostics.Common.dll
Methods
BeginScope<TState>(TState)
public IDisposable BeginScope<TState>(TState state)Begins a logical operation scope.
| Parameter | |
|---|---|
| Name | Description | 
| state | TStateThe identifier for the scope. | 
| Returns | |
|---|---|
| Type | Description | 
| IDisposable | An IDisposable that ends the logical operation scope on dispose. | 
| Type Parameter | |
|---|---|
| Name | Description | 
| TState | The type of the state to begin scope for. | 
GetGcpConsoleLogsUrl()
public Uri GetGcpConsoleLogsUrl()For diagnostic purposes. Builds and returns the URL where the entries logged by this GoogleLogger can be seen on the Google Cloud Logging Console.
| Returns | |
|---|---|
| Type | Description | 
| Uri | |
IsEnabled(LogLevel)
public bool IsEnabled(LogLevel logLevel)Checks if the given logLevel is enabled.
| Parameter | |
|---|---|
| Name | Description | 
| logLevel | LogLevelLevel to be checked. | 
| Returns | |
|---|---|
| Type | Description | 
| bool | 
 | 
Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)Writes a log entry.
| Parameters | |
|---|---|
| Name | Description | 
| logLevel | LogLevelEntry will be written on this level. | 
| eventId | EventIdId of the event. | 
| state | TStateThe entry to be written. Can be also an object. | 
| exception | ExceptionThe exception related to this entry. | 
| formatter | FuncExceptionstringFunction to create a string message of the  | 
| Type Parameter | |
|---|---|
| Name | Description | 
| TState | The type of the object to be written. |