PHPackages                             waffle-commons/log - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. waffle-commons/log

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

waffle-commons/log
==================

Log component for Waffle framework.

0.1.0-beta4(1mo ago)117↓50%1MITPHPPHP ^8.5CI passing

Since May 3Pushed 1mo agoCompare

[ Source](https://github.com/waffle-commons/log)[ Packagist](https://packagist.org/packages/waffle-commons/log)[ RSS](/packages/waffle-commons-log/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (7)Dependencies (14)Versions (10)Used By (1)

[![Discord](https://camo.githubusercontent.com/b30f41baece56d71f7f496f7e39fd33a2a096221c66c648b350dd4fe14276c2e/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3735353238383030313539323033333339313f6c6f676f3d646973636f7264)](https://discord.gg/eKgywnfXr2)[![PHP Version Require](https://camo.githubusercontent.com/2e73fa3d617bffa6052c3fe7c23b253a3cdbc9d2d912ba9b8fda322e02295133/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f6c6f672f726571756972652f706870)](https://packagist.org/packages/waffle-commons/log)[![PHP CI](https://github.com/waffle-commons/log/actions/workflows/main.yml/badge.svg)](https://github.com/waffle-commons/log/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/11aa7ef07c4c0af77098ddc1b415f941b20dacd4766b2f506810b546bd665437/68747470733a2f2f636f6465636f762e696f2f67682f776166666c652d636f6d6d6f6e732f6c6f672f67726170682f62616467652e7376673f746f6b656e3d64373461633632612d373837322d343033352d386238622d626363336166313939316530)](https://codecov.io/gh/waffle-commons/log)[![Latest Stable Version](https://camo.githubusercontent.com/36a253c327cd7b1d88304563a116542774b56ad1cf3cd9c5ef5f67f39d3a3746/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f6c6f672f76)](https://packagist.org/packages/waffle-commons/log)[![Latest Unstable Version](https://camo.githubusercontent.com/5d33f4583484db91d3371f2442980db3b5ec162f751ebc8ec756bc2338d02456/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f6c6f672f762f756e737461626c65)](https://packagist.org/packages/waffle-commons/log)[![Total Downloads](https://camo.githubusercontent.com/09cb1eae2b19cc04cedd9cfabecc12796eda8f2762e25fce484a73730b920451/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776166666c652d636f6d6d6f6e732f6c6f672e737667)](https://packagist.org/packages/waffle-commons/log)[![Packagist License](https://camo.githubusercontent.com/c54e480fee0144fc399cc97ff5ce701e765ddfc9157aa6516974a5e31b4659a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776166666c652d636f6d6d6f6e732f6c6f67)](https://github.com/waffle-commons/log/blob/main/LICENSE.md)

Waffle Log Component
====================

[](#waffle-log-component)

> **Release:** `0.1.0-beta4` | [`CHANGELOG.md`](./CHANGELOG.md)**PSR 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
--------------

[](#-installation)

```
composer require waffle-commons/log
```

🧱 Surface
---------

[](#-surface)

ClassRole`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
-------

[](#-usage)

`StreamLogger` exposes its configuration via PHP 8.5 **asymmetric visibility** (`public private(set)`) and `readonly` promoted properties:

```
use Waffle\Commons\Log\StreamLogger;
use Waffle\Commons\Log\Channel\LogChannel;

$logger = new StreamLogger(
    streamPath: 'php://stderr',
    channel: LogChannel::HTTP,
    permissions: 0o644,
);

$logger->info('Request handled', ['route' => '/users', 'status' => 200]);
```

The signature, verbatim from `src/StreamLogger.php`:

```
public function __construct(
    private(set) readonly string $streamPath = 'php://stderr',
    private(set) readonly string $channel = LogChannel::APP,
    private(set) readonly int $permissions = 0o644,
) { /* opens the stream, chmods if it's a regular file */ }
```

🪵 Output format
---------------

[](#-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:

```
{"time":"2026-05-16T10:42:01.123+00:00","level":"info","channel":"http","message":"Request handled","context":{"route":"/users","status":200}}
```

RFC 5424 / Monolog level constants (DEBUG=100 … EMERGENCY=600) are interpolated from `Psr\Log\LogLevel` — no custom level vocabulary.

🧷 Channels
----------

[](#-channels)

`LogChannel` is a typed-constant container (intentionally not a backed enum, so it can be used as a property default):

```
final class LogChannel
{
    public const string APP = 'app';
    public const string CORE = 'core';
    public const string HTTP = 'http';
    public const string SECURITY = 'sec';
    public const string AUDIT = 'audit';
}
```

🛡️ Worker-mode safety
---------------------

[](#️-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 `StreamLogger` instances can co-exist (one per channel, for example).

🧭 Architectural boundary (`mago guard`)
---------------------------------------

[](#-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`](./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\**` — itself
- `Waffle\Commons\Contracts\**` — the shared contracts package, the **only** Waffle dependency permitted
- `Psr\**` — 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
---------

[](#-testing)

```
docker exec -w /waffle-commons/log waffle-dev composer tests
```

📄 License
---------

[](#-license)

MIT — see [LICENSE.md](./LICENSE.md).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance92

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

7

Last Release

41d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34a7557a3fb23aaf788ca3892b9b7efdf96e753264bafd0599153c9e8a921316?d=identicon)[LesliePetrimaux](/maintainers/LesliePetrimaux)

---

Top Contributors

[![supa-chayajin](https://avatars.githubusercontent.com/u/695448?v=4)](https://github.com/supa-chayajin "supa-chayajin (44 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/waffle-commons-log/health.svg)

```
[![Health](https://phpackages.com/badges/waffle-commons-log/health.svg)](https://phpackages.com/packages/waffle-commons-log)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[illuminate/log

The Illuminate Log package.

6225.3M647](/packages/illuminate-log)[pagemachine/typo3-formlog

Form log for TYPO3

23238.6k8](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
