public sealed class GoogleLogger : ILogger
Reference 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 |
TState The 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 |
LogLevel Level 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 |
LogLevel Entry will be written on this level. |
eventId |
EventId Id of the event. |
state |
TState The entry to be written. Can be also an object. |
exception |
Exception The exception related to this entry. |
formatter |
FuncExceptionstring Function to create a string message of the |
Type Parameter | |
---|---|
Name | Description |
TState |
The type of the object to be written. |