Logger
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\Loggeris the PSR-3 logger users callQuantum\Logger\Factories\LoggerFactoryresolves and caches logger instances by adapter name- adapters implement
Quantum\Logger\Contracts\ReportableInterface Quantum\Logger\LoggerConfigholds the active severity threshold map- helper functions expose the common entry points globally
Adapter model
Logger supports these adapter names:
singledailymessage
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= 100info= 200notice= 250warning= 300error= 400critical= 500alert= 550emergency= 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
LoggerConfigstate, so resolving a logger updates process-wide logging behavior. LoggerFactorycaches oneLoggerinstance per adapter name inside the factory service.- The
messageadapter is not available outside debug mode. - File adapters only use the
tracecontext 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
dailyadapter picks its<YYYY-MM-DD>.logfile when the adapter is created. In long-running workers, recreate/re-resolve the logger after midnight if you need strict daily rollover.