# InMemoryLogBuffer Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/)

## AssertNoWarningsOrErrors {#assertnowarningsorerrors-6074ae75}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/assertnowarningsorerrors-6074ae75/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L135-L150)

```csharp
public void AssertNoWarningsOrErrors()
```

Asserts that no warnings or errors were logged, throwing an exception if any exist.

### Exceptions

- `System.InvalidOperationException`: Thrown when warnings or errors exist in the log.

## Clear {#clear-e59cbcd6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/clear-e59cbcd6/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L73)

```csharp
public void Clear()
```

Clears all buffered log entries.

## FormatAllEntries {#formatallentries-b63d9aec}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/formatallentries-b63d9aec/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L78)

```csharp
public string FormatAllEntries()
```

Formats all log entries as a string.

## FormatAllEntriesWithSize {#formatallentrieswithsize-af1bdd0d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/formatallentrieswithsize-af1bdd0d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L114-L116)

```csharp
public (string Content, long SizeBytes) InMemoryLogBuffer.FormatAllEntriesWithSize()
```

Formats the actual entries and returns both the formatted string and its byte size.

## FormatEntries(LogLevel) {#formatentries-microsoft-extensions-logging-loglevel-85e134bb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/formatentries-microsoft-extensions-logging-loglevel-85e134bb/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L83)

```csharp
public string FormatEntries(LogLevel minimumLevel)
```

Formats log entries at or above the specified minimum level as a string.

### Parameters

- `minimumLevel` (`LogLevel`)

## FormatEntriesWithSize(LogLevel) {#formatentrieswithsize-microsoft-extensions-logging-loglevel-db376808}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/formatentrieswithsize-microsoft-extensions-logging-loglevel-db376808/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L124-L126)

```csharp
public (string Content, long SizeBytes) InMemoryLogBuffer.FormatEntriesWithSize(LogLevel minimumLevel)
```

Formats entries at or above the specified level and returns both the formatted string and its byte size.

### Parameters

- `minimumLevel` (`LogLevel`)

## GetEntries(LogLevel) {#getentries-microsoft-extensions-logging-loglevel-21c207c2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/getentries-microsoft-extensions-logging-loglevel-21c207c2/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L32)

```csharp
public IEnumerable<LogEntry> GetEntries(LogLevel minimumLevel)
```

Gets log entries filtered by minimum log level.

### Parameters

- `minimumLevel` (`LogLevel`)

## HasEntriesAtOrAbove(LogLevel) {#hasentriesatorabove-microsoft-extensions-logging-loglevel-575f2eda}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/hasentriesatorabove-microsoft-extensions-logging-loglevel-575f2eda/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L37)

```csharp
public bool HasEntriesAtOrAbove(LogLevel level)
```

Returns true if any entries exist at or above the specified log level.

### Parameters

- `level` (`LogLevel`)

## Log(LogLevel, EventId, TState, Exception?, Func&lt;TState, Exception?, string&gt;, string) {#log-1-microsoft-extensions-logging-loglevel-microsoft-extensions-logging-eventid-26035048}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogbuffer/methods/log-1-microsoft-extensions-logging-loglevel-microsoft-extensions-logging-eventid-26035048/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/Logging/InMemoryLoggerProvider.cs#L55-L68)

```csharp
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter, string category)
```

Logs a message to the buffer.

### Parameters

- `logLevel` (`LogLevel`)
- `eventId` (`EventId`)
- `state` (`TState`)
- `exception` (`Exception?`)
- `formatter` (`Func<TState, Exception?, string>`)
- `category` (`string`)
