> For the complete documentation index, see [llms.txt](https://quantumphp.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantumphp.gitbook.io/docs/packages/logger/adapters.md).

# Adapters

Logger ships with three adapters.

## `single`

`SingleAdapter` writes every accepted log entry to one configured file path.

### Expected config shape

The adapter expects `logging.single.path` to point to a file path, for example:

```php
[
    'path' => base_dir() . DS . 'storage' . DS . 'logs' . DS . 'app.log',
]
```

### Contract

At construction time, the adapter checks that the configured path looks like a file path (has an extension).

If it does not, the adapter throws `LoggerException::logPathIsNotFile(...)`.

The adapter does not pre-create directories for you; the target path must be writable by your runtime.

Use `single` when you want one append-only log file.

## `daily`

`DailyAdapter` writes to a file named after the current date inside a configured directory.

### Expected config shape

The adapter expects `logging.daily.path` to point to an existing directory, for example:

```php
[
    'path' => base_dir() . DS . 'storage' . DS . 'logs',
]
```

At runtime it writes to:

```
<path>/<YYYY-MM-DD>.log
```

### Contract

At construction time, the adapter requires the configured path to already be a directory.

If it is not, the adapter throws `LoggerException::logPathIsNotDirectory(...)`.

The daily filename is chosen when the adapter instance is created. In long-running processes, rotate/re-resolve the logger after date rollover if you need strict day-boundary files.

Use `daily` when you want automatic file splitting by day.

## `message`

`MessageAdapter` sends accepted log entries to Quantum's debugger message store instead of the filesystem.

### How tab routing works

The adapter uses:

* `Debugger::MESSAGES` by default
* `context['tab']` when you pass one

Example:

```php
logger()->info('Mailer connected', ['tab' => 'mails']);
```

The debugger store receives the level and raw message as separate values. File-style formatting and `trace` appends are specific to the file adapters.

### Contract

* available only in debug mode
* writes only when `debugbar()->isEnabled()` is true
* ignores file-path config because it has no constructor parameters

Outside debug mode, explicitly requesting `message` causes the factory to throw an adapter-not-supported exception.

## File output format

Both file adapters use the same line format:

```
[YYYY-MM-DD HH:MM:SS] Level: message
```

If you pass `['trace' => $trace]`, the trace is appended on the next line before the final newline.

If you pass an array message, the package JSON-encodes it with pretty printing before writing.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://quantumphp.gitbook.io/docs/packages/logger/adapters.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
