# Levels



Flare uses [Monolog log levels](https://github.com/Seldaek/monolog/blob/main/doc/01-usage.md#log-levels) throughout its logging system. The following levels are available, from most to least severe:

| Level | Description |
| ----- | ----------- |
| `Level::Emergency` | System is unusable |
| `Level::Alert` | Action must be taken immediately |
| `Level::Critical` | Critical conditions |
| `Level::Error` | Error conditions |
| `Level::Warning` | Warning conditions |
| `Level::Notice` | Normal but significant condition |
| `Level::Info` | Informational messages |
| `Level::Debug` | Debug-level messages |

When you set a minimal log level, only logs at that level **or above** (more severe) will be collected.

## Where log levels can be configured

There are two places where you can configure log levels, each controlling a different part of the logging system.

### Standalone log shipping

When enabling log collection in your `config/flare.php` file, you can set a minimal level for logs that are shipped to Flare as standalone entities:

```php
// config/flare.php
'log' => true,

'minimal_log_level' => \Monolog\Level::Warning,
```

When set, only logs at `Warning` or above will be sent to Flare. When `null` (the default), all log levels are sent.

This is the primary level gate. If a log doesn't pass this threshold, it won't be recorded at all — meaning it also won't be available for inclusion with error reports.

### Logs with errors

When an error occurs, recent log entries are included alongside the error report. You can set a separate minimal level for these logs in the `collects` config:

```php
use Spatie\FlareClient\Enums\CollectType;

'collects' => FlareConfig::defaultCollects(
    extra: [
        CollectType::LogsWithErrors->value => [
            'minimal_level' => \Monolog\Level::Warning,
        ],
    ]
),
```

The default level is `Level::Info`. This level only filters logs that were already recorded by the logger — it cannot include logs that were filtered out by the `minimal_log_level` setting.

## How the levels interact

The `minimal_log_level` setting is the primary gate. It determines which logs are recorded at all. The logs-with-errors level is a secondary filter that only applies when attaching logs to error reports.

For example, if you set `minimal_log_level` to `Level::Warning` and the logs-with-errors level to `Level::Info`, the logs-with-errors level has no effect — `Info` logs were never recorded in the first place.

As a rule of thumb: the logs-with-errors minimal level should always be **equal to or higher than** the `minimal_log_level` setting.