# `Supertester.LoggerIsolation`
[🔗](https://github.com/nshkrdotcom/supertester/blob/v0.6.0/lib/supertester/logger_isolation.ex#L1)

Per-process Logger level isolation utilities for async-safe testing.

# `capture_opts`

```elixir
@type capture_opts() :: [
  level: level(),
  colors: boolean(),
  format: String.t(),
  metadata: [atom()]
]
```

# `isolate_opts`

```elixir
@type isolate_opts() :: [{:cleanup, boolean()}]
```

# `level`

```elixir
@type level() ::
  :emergency | :alert | :critical | :error | :warning | :notice | :info | :debug
```

# `level_or_all`

```elixir
@type level_or_all() :: level() | :all | :none
```

# `capture_isolated`

```elixir
@spec capture_isolated(level_or_all(), (-&gt; term()), capture_opts()) ::
  {String.t(), term()}
```

Capture logs with automatic level isolation.

# `capture_isolated!`

```elixir
@spec capture_isolated!(level_or_all(), (-&gt; term()), capture_opts()) :: String.t()
```

Capture logs with automatic level isolation and return only the log.

# `get_isolated_level`

```elixir
@spec get_isolated_level() :: level() | nil
```

Get the current process isolated level.

# `isolate_level`

```elixir
@spec isolate_level(level_or_all(), isolate_opts()) :: :ok
```

Set the Logger level for the current process only.

# `isolated?`

```elixir
@spec isolated?() :: boolean()
```

Check if logger isolation is active.

# `restore_level`

```elixir
@spec restore_level() :: :ok
```

Restore the process Logger level to its original state.

# `setup_logger_isolation`

```elixir
@spec setup_logger_isolation() :: :ok
```

Initialize logger isolation for the current process.

# `setup_logger_isolation`

```elixir
@spec setup_logger_isolation(Supertester.IsolationContext.t()) ::
  {:ok, Supertester.IsolationContext.t()}
```

Initialize logger isolation and update the isolation context.

# `with_level`

```elixir
@spec with_level(level_or_all(), (-&gt; result)) :: result when result: term()
```

Execute a function with a temporary Logger level.

# `with_level_and_capture`

```elixir
@spec with_level_and_capture(level_or_all(), (-&gt; result)) :: {String.t(), result}
when result: term()
```

Execute a function with a temporary Logger level and capture logs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
