# InMemoryLogger Methods

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

## BeginScope(TState) {#beginscope-1-tstate-c45c64f5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogger/methods/beginscope-1-tstate-c45c64f5/)

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

```csharp
public IDisposable? BeginScope<TState>(TState state)
```

Begins a logical operation scope.

### Parameters

- `state` (`TState`): The identifier for the scope.

### Returns

An `System.IDisposable` that ends the logical operation scope on dispose.

## IsEnabled(LogLevel) {#isenabled-microsoft-extensions-logging-loglevel-0da3b72e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.logging.inmemorylogger/methods/isenabled-microsoft-extensions-logging-loglevel-0da3b72e/)

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

```csharp
public bool IsEnabled(LogLevel logLevel)
```

Checks if the given `logLevel` is enabled.

### Parameters

- `logLevel` (`LogLevel`): Level to be checked.

### Returns

`true` if enabled.

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

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

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

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

Writes a log entry.

### Parameters

- `logLevel` (`LogLevel`): Entry will be written on this level.
- `eventId` (`EventId`): Id of the event.
- `state` (`TState`): The entry to be written. Can be also an object.
- `exception` (`Exception?`): The exception related to this entry.
- `formatter` (`Func<TState, Exception?, string>`): Function to create a `System.String` message of the `state` and `exception`.
