1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public sealed class MemoryLogger : BaseLogger

A logger than logs to an in-memory buffer.
Generally for use during tests.

## 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.md.txt) \> MemoryLogger

## Inherited Members

[BaseLogger.Clock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_Clock) [BaseLogger.LoggerForType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_LoggerForType) [BaseLogger.MinimumLogLevel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_MinimumLogLevel) [BaseLogger.IsDebugEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_IsDebugEnabled) [BaseLogger.IsInfoEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_IsInfoEnabled) [BaseLogger.IsWarningEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_IsWarningEnabled) [BaseLogger.IsErrorEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_IsErrorEnabled) [BaseLogger.ForType\<T\>()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#Google_Apis_Logging_BaseLogger_ForType__1) [BaseLogger.ForType(Type)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.BaseLogger.md.txt#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.md.txt#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.md.txt#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.md.txt#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.md.txt#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.md.txt#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.md.txt)

## Assembly

Google.Apis.Core.dll

## Constructors

### MemoryLogger(LogLevel, int, IClock)

    public MemoryLogger(LogLevel minimumLogLevel, int maximumEntryCount = 1000, IClock clock = null)

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `minimumLogLevel` | `LogLevel` Logging will be enabled at this level and all higher levels. |
| `maximumEntryCount` | `int` The maximum number of log entries. Further log entries will be silently discarded. |
| `clock` | `IClock` Optional [IClock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.IClock.md.txt); will use the system clock if `null`. |

## Properties

### LogEntries

    public IList<string> LogEntries { get; }

The list of log entries.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `IListstring` |   |

## 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` | `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.md.txt#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` | `LogLevel` The [LogLevel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Logging.LogLevel.md.txt) of this log entry. |
| `formattedMessage` | `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.md.txt#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.md.txt#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)