# LogCounts

> Typed view-model for the log-level totals shown in the detail view's summary header.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Log](/docs/extensions/debug-core/reference/panel/log/index.md) › LogCounts

| final readonly class | `PHPForge\Debug\Panel\Log\LogCounts` |
| --- | --- |
| Source | [`src/Panel/Log/LogCounts.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Log/LogCounts.php#L14) |

Typed view-model for the log-level totals shown in the detail view's summary header.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-errors"></span>`$errors` readonly constructor | `int` | Number of messages at `LogLevel::ERROR`. | `LogCounts` |
| <span id="property-info"></span>`$info` readonly constructor | `int` | Number of messages at `LogLevel::INFO`. | `LogCounts` |
| <span id="property-total"></span>`$total` readonly constructor | `int` | Total number of log messages captured for the request. | `LogCounts` |
| <span id="property-trace"></span>`$trace` readonly constructor | `int` | Number of messages at `LogLevel::TRACE`. Default: `0`. | `LogCounts` |
| <span id="property-warnings"></span>`$warnings` readonly constructor | `int` | Number of messages at `LogLevel::WARNING`. | `LogCounts` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the log-level totals for the detail view. | `LogCounts` |
| [`fromRows()`](#method-fromRows) static | Builds log-level totals from the captured rows. | `LogCounts` |
| [`hasErrors()`](#method-hasErrors) | Returns whether at least one `error`-level message was captured. | `LogCounts` |
| [`hasInfo()`](#method-hasInfo) | Returns whether at least one `info`-level message was captured. | `LogCounts` |
| [`hasTrace()`](#method-hasTrace) | Returns whether at least one `trace`-level message was captured. | `LogCounts` |
| [`hasWarnings()`](#method-hasWarnings) | Returns whether at least one `warning`-level message was captured. | `LogCounts` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(int $total, int $errors, int $warnings, int $info, int $trace = 0)
```

Creates the log-level totals for the detail view.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$total` | `int` |  |
| `$errors` | `int` |  |
| `$warnings` | `int` |  |
| `$info` | `int` |  |
| `$trace` | `int` |  |

### fromRows() <span id="method-fromRows"></span>

```php
public static function fromRows(list<PHPForge\Debug\Panel\Log\LogRow> $rows): self
```

Builds log-level totals from the captured rows.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$rows` | `list<`[`LogRow`](/docs/extensions/debug-core/reference/panel/log/logrow/index.md)`>` | Captured log rows. |

**Returns**

`self`

### hasErrors() <span id="method-hasErrors"></span>

```php
public function hasErrors(): bool
```

Returns whether at least one `error`-level message was captured.

**Returns**

`bool`

### hasInfo() <span id="method-hasInfo"></span>

```php
public function hasInfo(): bool
```

Returns whether at least one `info`-level message was captured.

**Returns**

`bool`

### hasTrace() <span id="method-hasTrace"></span>

```php
public function hasTrace(): bool
```

Returns whether at least one `trace`-level message was captured.

**Returns**

`bool`

### hasWarnings() <span id="method-hasWarnings"></span>

```php
public function hasWarnings(): bool
```

Returns whether at least one `warning`-level message was captured.

**Returns**

`bool`