Download the PHP package waffle-commons/log without Composer
On this page you can find all versions of the php package waffle-commons/log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waffle-commons/log
More information about waffle-commons/log
Files in waffle-commons/log
Package log
Short Description PSR-3 logging for Waffle Commons: a minimal stream logger with channel separation, safe to hold across FrankenPHP worker requests.
License MIT
Informations about the package log
Waffle Log Component
Release:
0.1.0-beta6|CHANGELOG.mdPSR Compliance: PSR-3 (Psr\Log\AbstractLogger)
A strict, container-native logger that emits one JSON line per record onto a stream. Designed for Docker/Kubernetes deployments where stdout/stderr are the log sinks โ no buffering, no per-process state, safe across FrankenPHP worker requests.
๐ฆ Installation
๐งฑ Surface
| Class | Role |
|---|---|
Waffle\Commons\Log\StreamLogger |
PSR-3 AbstractLogger writing JSON-formatted records to any PHP stream (php://stderr, php://stdout, file paths). |
Waffle\Commons\Log\Channel\LogChannel |
Typed-constant container for canonical log-channel names (APP, CORE, HTTP, SECURITY, AUDIT). |
๐ Usage
StreamLogger exposes its configuration via PHP 8.5 asymmetric visibility (public private(set)) and readonly promoted properties:
The signature, verbatim from src/StreamLogger.php:
๐ชต Output format
Every record is a single JSON object emitted with a trailing \n, suitable for Docker's JSON-file driver and for jq/grep pipelines:
RFC 5424 / Monolog level constants (DEBUG=100 โฆ EMERGENCY=600) are interpolated from Psr\Log\LogLevel โ no custom level vocabulary.
๐งท Channels
LogChannel is a typed-constant container (intentionally not a backed enum, so it can be used as a property default):
๐ก๏ธ Worker-mode safety
- Stream is opened in the constructor and closed in
__destruct(), preventing file-descriptor leaks across long-running workers. - No per-call buffering; each
log()call writes immediately. - No static state. Multiple
StreamLoggerinstances can co-exist (one per channel, for example).
๐งญ Architectural boundary (mago guard)
An active dependency perimeter is enforced on every CI run by vendor/bin/mago guard (bundled into composer mago; zero baselines). The rules live in mago.toml under [guard.perimeter] โ a forbidden use statement fails the build, not a reviewer.
Production code under Waffle\Commons\Log may depend only on:
Waffle\Commons\Log\**โ itselfWaffle\Commons\Contracts\**โ the shared contracts package, the only Waffle dependency permittedPsr\**โ PSR interfaces (PSR-3)@global+Psl\**โ PHP core and the PHP Standard Library
Test code under WaffleTests\Commons\Log is unrestricted (@all). Structural rules are guarded too: interfaces must be named *Interface, Exception\** classes must end in *Exception, and any Enum\** namespace may hold only enum declarations.
Contract-first, component-agnostic by construction: components compose through waffle-commons/contracts, never directly through one another.
๐งช Testing
๐ Documentation
Central framework docs live in the waffle-commons/documentation repository:
- Reference: log
๐ License
MIT โ see LICENSE.md.