# LogPanel

> Presents captured log messages and contributes the total, error, and warning toolbar metrics.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Panel](/docs/extensions/yii3-debug/reference/panel/index.md) › LogPanel

| final readonly class | `Yii3\Debug\Panel\LogPanel` |
| --- | --- |
| Implements | [`ToolbarPanelProviderInterface`](/docs/extensions/yii3-debug/reference/panel/toolbarpanelproviderinterface/index.md) |
| Source | [`src/Panel/LogPanel.php`](https://github.com/yii3/debug/blob/main/src/Panel/LogPanel.php#L28) |

Presents captured log messages and contributes the total, error, and warning toolbar metrics.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the Logs panel with its configured source-frame renderer. | `LogPanel` |
| [`hasContent()`](#method-hasContent) | Reports whether the capture recorded log messages worth opening the panel for. | `LogPanel` |
| [`icon()`](#method-icon) | Returns the icon key shared with the built-in Logs navigation entry. | `LogPanel` |
| [`id()`](#method-id) | Returns the identifier associating the panel with its slice of the captured payload. | `LogPanel` |
| [`name()`](#method-name) | Returns the panel title shown in the debugger navigation. | `LogPanel` |
| [`render()`](#method-render) | Renders the detail view, letting the page context drive filtering, sorting, and paging. | `LogPanel` |
| [`toolbarItems()`](#method-toolbarItems) | Builds the toolbar metrics: the total message count plus the error and warning counts. | `LogPanel` |

## Method details

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

```php
public function __construct(PHPForge\Debug\Helper\Trace $trace)
```

Creates the Logs panel with its configured source-frame renderer.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$trace` | [`Trace`](https://github.com/php-forge/debug-core/blob/b70459f033a1d7a1c5edf7951029aad2061986dd/src/Helper/Trace.php) | Configured renderer of the argument-free source frames shown in the message cells. |

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

```php
public function hasContent(array<string, mixed> $payload): bool
```

Reports whether the capture recorded log messages worth opening the panel for.

The capture is listed whenever it carries a payload; the detail page and the toolbar chip surface a malformed
one when they hydrate it.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` | Serialized panel payload. |

**Returns**

`bool`: `true` when the capture carried data; `false` otherwise.

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

```php
public function icon(): string
```

Returns the icon key shared with the built-in Logs navigation entry.

**Returns**

`string`: Shared Debug Core icon key.

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

```php
public function id(): string
```

Returns the identifier associating the panel with its slice of the captured payload.

**Returns**

`string`: Stable panel identifier.

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

```php
public function name(): string
```

Returns the panel title shown in the debugger navigation.

**Returns**

`string`: Human-readable panel name.

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

```php
public function render(Yii3\Debug\Panel\PanelRenderInput $input): string
```

Renders the detail view, letting the page context drive filtering, sorting, and paging.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$input` | [`PanelRenderInput`](/docs/extensions/yii3-debug/reference/panel/panelrenderinput/index.md) | Payload, request context, and request summary of the page being rendered. |

**Returns**

`string`: Rendered panel markup.

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

```php
public function toolbarItems(array<string, mixed> $payload): list<PHPForge\Debug\Toolbar\ToolbarItem>
```

Builds the toolbar metrics: the total message count plus the error and warning counts.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` | Serialized panel payload. |

**Returns**

`list<PHPForge\Debug\Toolbar\ToolbarItem>`: Toolbar metrics in display order.