# Class ConsoleLogger (1.73.0)

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

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.ConsoleLogger)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Logging.ConsoleLogger)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Logging.ConsoleLogger)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Logging.ConsoleLogger)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Logging.ConsoleLogger)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Logging.ConsoleLogger)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Logging.ConsoleLogger)

    public sealed class ConsoleLogger : BaseLogger

A logger than logs to StdError or StdOut.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [BaseLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger) \> ConsoleLogger

## Inherited Members

[BaseLogger.Clock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Clock) [BaseLogger.LoggerForType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_LoggerForType) [BaseLogger.MinimumLogLevel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_MinimumLogLevel) [BaseLogger.IsDebugEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_IsDebugEnabled) [BaseLogger.IsInfoEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_IsInfoEnabled) [BaseLogger.IsWarningEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_IsWarningEnabled) [BaseLogger.IsErrorEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_IsErrorEnabled) [BaseLogger.ForType\<T\>()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_ForType__1) [BaseLogger.ForType(Type)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_ForType_System_Type_) [BaseLogger.Debug(string, params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Debug_System_String_System_Object___) [BaseLogger.Info(string, params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Info_System_String_System_Object___) [BaseLogger.Warning(string, params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Warning_System_String_System_Object___) [BaseLogger.Error(Exception, string, params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Error_System_Exception_System_String_System_Object___) [BaseLogger.Error(string, params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Error_System_String_System_Object___) [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Logging](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging)

## Assembly

Google.Apis.Core.dll

## Constructors

### ConsoleLogger(LogLevel, bool, IClock)

    public ConsoleLogger(LogLevel minimumLogLevel, bool logToStdOut = false, IClock clock = null)

Construct a [ConsoleLogger](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.ConsoleLogger).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `minimumLogLevel` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.LogLevel` Logging will be enabled at this level and all higher levels. |
| `logToStdOut` | `https://learn.microsoft.com/dotnet/api/system.boolean` `true` to log to StdOut, defaults to logging to StdError. |
| `clock` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock` Optional [IClock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock); will use the system clock if `null`. |

## Properties

### LogToStdOut

    public bool LogToStdOut { get; }

`false` to log to StdError; `true` to log to StdOut.

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

## Methods

### BuildNewLogger(Type)

    protected override ILogger BuildNewLogger(Type type)

Build a new logger of the derived concrete type, for use to log from the specified type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://learn.microsoft.com/dotnet/api/system.type` The type from which entries are being logged. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google.Apis.Logging.ILogger` | A new Google.Apis.Logging.ILogger instance, logging from the specified type. |

**Overrides** [BaseLogger.BuildNewLogger(Type)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_BuildNewLogger_System_Type_)

### Log(LogLevel, string)

    protected override void Log(LogLevel logLevel, string formattedMessage)

Perform the actual logging.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `logLevel` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.LogLevel` The [LogLevel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.LogLevel) of this log entry. |
| `formattedMessage` | `https://learn.microsoft.com/dotnet/api/system.string` The fully formatted log message, ready for logging. |

**Overrides** [BaseLogger.Log(LogLevel, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger#Google_Apis_Logging_BaseLogger_Log_Google_Apis_Logging_LogLevel_System_String_)

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)