> 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/overview.md).

# Overview

The Logger package gives Quantum a small PSR-3-compatible logging layer with three delivery modes:

* write to one file
* write to a date-based daily file
* send messages to the DebugBar message store during debug mode

Use it when you want framework-level logging through `logger()` or the global level helpers, while keeping the output backend configurable.

## When to use it

Reach for Logger when you need to:

* record application errors or warnings to disk
* switch between a single log file and one file per day
* surface debug messages inside Quantum's debugger instead of writing files

If you only need a raw filesystem append, use Storage directly. Logger is useful when you want severity filtering and adapter selection.

## Package shape

The package is built from a few small parts:

* `Quantum\Logger\Logger` is the PSR-3 logger users call
* `Quantum\Logger\Factories\LoggerFactory` resolves and caches logger instances by adapter name
* adapters implement `Quantum\Logger\Contracts\ReportableInterface`
* `Quantum\Logger\LoggerConfig` holds the active severity threshold map
* helper functions expose the common entry points globally

## Adapter model

Logger supports these adapter names:

* `single`
* `daily`
* `message`

In normal runtime, the factory uses the requested adapter or the configured default.

In debug mode, the factory always resolves the `message` adapter instead. That means debug runs send logs to the debugger message store, not to file-based adapters.

## Severity filtering

The package compares levels with this built-in order:

* `debug` = 100
* `info` = 200
* `notice` = 250
* `warning` = 300
* `error` = 400
* `critical` = 500
* `alert` = 550
* `emergency` = 600

The default threshold is `error`.

Outside debug mode, a message is reported only when its severity is greater than or equal to the current application threshold.

In debug mode, `Logger::log()` bypasses threshold filtering and reports every call.

## Important constraints

* The active log threshold is stored in static `LoggerConfig` state, so resolving a logger updates process-wide logging behavior.
* `LoggerFactory` caches one `Logger` instance per adapter name inside the factory service.
* The `message` adapter is not available outside debug mode.
* File adapters only use the `trace` context key for output formatting. Other context values are ignored by file logging.
* The package does not validate arbitrary custom level strings. Stick to standard PSR log levels for predictable filtering and output.
* The `daily` adapter picks its `<YYYY-MM-DD>.log` file when the adapter is created. In long-running workers, recreate/re-resolve the logger after midnight if you need strict daily rollover.


---

# 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/overview.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.
