# Class GoogleLogger (4.4.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [4.4.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLogger)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/4.3.1/Google.Cloud.Diagnostics.AspNetCore.GoogleLogger)

    [Obsolete("Use Google.Cloud.Diagnostics.Common.GoogleLogger instead.")]
    public sealed class GoogleLogger : ILogger

[ILogger](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger) for Google Cloud Logging.

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) \> GoogleLogger

## Implements

[ILogger](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger)

## Inherited Members

[Object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode#system-object-gethashcode) [Object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype#system-object-gettype) [Object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone#system-object-memberwiseclone) [Object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring#system-object-tostring)

## Namespace

[Google.Cloud.Diagnostics.AspNetCore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore)

## Assembly

Google.Cloud.Diagnostics.AspNetCore.dll

## Methods

### BeginScope\<TState\>(TState)

    public IDisposable BeginScope<TState>(TState state)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `state` | `TState` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.idisposable` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `TState` |   |

### GetGcpConsoleLogsUrl()

    public Uri GetGcpConsoleLogsUrl()

For diagnostic purposes. Builds and returns the URL where the entries logged by
this [GoogleLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore/latest/Google.Cloud.Diagnostics.AspNetCore.GoogleLogger) can be seen on the Google Cloud Logging Console.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.uri` |   |

### IsEnabled(LogLevel)

    public bool IsEnabled(LogLevel logLevel)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `logLevel` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.loglevel` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### 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)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `logLevel` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.loglevel` |
| `eventId` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.eventid` |
| `state` | `TState` |
| `exception` | `https://learn.microsoft.com/dotnet/api/system.exception` |
| `formatter` | `https://learn.microsoft.com/dotnet/api/system.func-3<TState, https://learn.microsoft.com/dotnet/api/system.exception, https://learn.microsoft.com/dotnet/api/system.string>` |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `TState` |   |