# Class BaseLogger (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.BaseLogger)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Logging.BaseLogger)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Logging.BaseLogger)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Logging.BaseLogger)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Logging.BaseLogger)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Logging.BaseLogger)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Logging.BaseLogger)

    public abstract class BaseLogger

An abstract base logger, upon which real loggers may be built.

## Inheritance

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

## Inherited Members

[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.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

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

## Namespace

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

## Assembly

Google.Apis.Core.dll

## Constructors

### BaseLogger(LogLevel, IClock, Type)

    protected BaseLogger(LogLevel minimumLogLevel, IClock clock, Type forType)

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

| **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. |
| `clock` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock` The [IClock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock) to use to timestamp log entries. |
| `forType` | `https://learn.microsoft.com/dotnet/api/system.type` The type from which entries are being logged. May be `null`. |

## Properties

### Clock

    public IClock Clock { get; }

The [IClock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock) being used to timestamp log entries.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock` |   |

### IsDebugEnabled

    public bool IsDebugEnabled { get; }

Is Debug level logging enabled?

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

### IsErrorEnabled

    public bool IsErrorEnabled { get; }

Is error level logging enabled?

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

### IsInfoEnabled

    public bool IsInfoEnabled { get; }

Is info level logging enabled?

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

### IsWarningEnabled

    public bool IsWarningEnabled { get; }

Is warning level logging enabled?

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

### LoggerForType

    public Type LoggerForType { get; }

The type from which entries are being logged. May be `null`.

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

### MinimumLogLevel

    public LogLevel MinimumLogLevel { get; }

Logging is enabled at this level and all higher levels.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.LogLevel` |   |

## Methods

### BuildNewLogger(Type)

    protected abstract 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. |

### Debug(string, params object\[\])

    public void Debug(string message, params object[] formatArgs)

Logs a debug message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://learn.microsoft.com/dotnet/api/system.string` The message to log. |
| `formatArgs` | `https://learn.microsoft.com/dotnet/api/system.object` String.Format arguments (if applicable). |

### Error(Exception, string, params object\[\])

    public void Error(Exception exception, string message, params object[] formatArgs)

Logs an error message resulting from an exception.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `exception` | `https://learn.microsoft.com/dotnet/api/system.exception` |
| `message` | `https://learn.microsoft.com/dotnet/api/system.string` The message to log. |
| `formatArgs` | `https://learn.microsoft.com/dotnet/api/system.object` String.Format arguments (if applicable). |

### Error(string, params object\[\])

    public void Error(string message, params object[] formatArgs)

Logs an error message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://learn.microsoft.com/dotnet/api/system.string` The message to log. |
| `formatArgs` | `https://learn.microsoft.com/dotnet/api/system.object` String.Format arguments (if applicable). |

### ForType(Type)

    public ILogger ForType(Type type)

Returns a logger which will be associated with the specified type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://learn.microsoft.com/dotnet/api/system.type` Type to which this logger belongs. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google.Apis.Logging.ILogger` | A type-associated logger. |

### ForType\<T\>()

    public ILogger ForType<T>()

Returns a logger which will be associated with the specified type.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google.Apis.Logging.ILogger` | A type-associated logger. |

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

### Info(string, params object\[\])

    public void Info(string message, params object[] formatArgs)

Logs an info message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://learn.microsoft.com/dotnet/api/system.string` The message to log. |
| `formatArgs` | `https://learn.microsoft.com/dotnet/api/system.object` String.Format arguments (if applicable). |

### Log(LogLevel, string)

    protected abstract 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. |

### Warning(string, params object\[\])

    public void Warning(string message, params object[] formatArgs)

Logs a warning.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://learn.microsoft.com/dotnet/api/system.string` The message to log. |
| `formatArgs` | `https://learn.microsoft.com/dotnet/api/system.object` String.Format arguments (if applicable). |

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