# LogTargetFactory

> Resolves the configured log target the module attaches to the application logger during the bootstrap.

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › [service](/docs/extensions/debug/reference/service/index.md) › LogTargetFactory

| class | `yii\debug\service\LogTargetFactory` |
| --- | --- |
| Source | [`src/service/LogTargetFactory.php`](https://github.com/yii2-extensions/debug/blob/main/src/service/LogTargetFactory.php#L15) |

Resolves the configured log target the module attaches to the application logger during the bootstrap.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-module"></span>`$module` protected readonly constructor | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md) | Debug module read for the log-target configuration at call time. | `LogTargetFactory` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Binds log-target resolution to the debug module. | `LogTargetFactory` |
| [`create()`](#method-create) | Resolves [`Module::$logTarget`](/docs/extensions/debug/reference/module/index.md#property-logTarget) into a [`LogTarget`](/docs/extensions/debug/reference/logtarget/index.md) instance, accepting a class-name string, a configuration array with a `class` key, or an already-instantiated target. | `LogTargetFactory` |

## Method details

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

```php
public function __construct(yii\debug\Module $module)
```

Binds log-target resolution to the debug module.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$module` | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md) | Debug module read for the log-target configuration at call time. |

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

```php
public function create(): yii\debug\LogTarget
```

Resolves [`Module::$logTarget`](/docs/extensions/debug/reference/module/index.md#property-logTarget) into a [`LogTarget`](/docs/extensions/debug/reference/logtarget/index.md) instance, accepting a class-name string, a
configuration array with a `class` key, or an already-instantiated target.

The module itself is handed to the target as the first constructor argument, so a custom target reaches the
panels and the storage it captures into.

**Returns**

[`yii\debug\LogTarget`](/docs/extensions/debug/reference/logtarget/index.md): Target built from the configured class name, array, or instance.

**Throws**

- [`yii\base\InvalidConfigException`](/docs/api/yii/base/invalidconfigexception/index.md): when the configured class is missing or does not produce a [`LogTarget`](/docs/extensions/debug/reference/logtarget/index.md).