PHPackages                             jardisadapter/logger - 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. jardisadapter/logger

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

jardisadapter/logger
====================

PSR-3 logging pipeline with 20+ handlers, 7 formatters, 6 enrichers, and fluent builder API; a building block of the open-source foundation that Jardis-generated DDD code runs on

v1.0.4(3w ago)02251MITPHPPHP &gt;=8.2CI passing

Since Jun 2Pushed 3w agoCompare

[ Source](https://github.com/jardisAdapter/logger)[ Packagist](https://packagist.org/packages/jardisadapter/logger)[ Docs](https://jardis.io)[ RSS](/packages/jardisadapter-logger/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)Dependencies (12)Versions (9)Used By (1)

Jardis Logger
=============

[](#jardis-logger)

[![Build Status](https://github.com/jardisAdapter/logger/actions/workflows/ci.yml/badge.svg)](https://github.com/jardisAdapter/logger/actions/workflows/ci.yml/badge.svg)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/a68b290dcc313d698dc138a1111aa83eee2f143605449d7e8b5416ea6f88558f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737374242342e737667)](https://www.php.net/)[![PHPStan Level](https://camo.githubusercontent.com/c51bda247654363d3e30bc352674dd761a9557803a14af0226eb411d6dc0006b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d627269676874677265656e2e737667)](phpstan.neon)[![PSR-12](https://camo.githubusercontent.com/34b10db0caa29bacd49bda5c437a8de95385f036f3230b31fa605326e18da22c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d5053522d2d31322d626c75652e737667)](phpcs.xml)[![PSR-3](https://camo.githubusercontent.com/76db838885931d8f63a37cc20c6d033675f31ac75a81dc9329d8289c8f1b042a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6f676765722d5053522d2d332d627269676874677265656e2e737667)](https://www.php-fig.org/psr/psr-3/)[![Coverage](https://camo.githubusercontent.com/446ee39531b16023361c043d89f79da09052da7f34c87c2366080ef599f6c83b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d38352e32342532352d677265656e2e737667)](https://github.com/jardisAdapter/logger)

> Part of **[Jardis](https://jardis.io)** — the Domain-Driven Design platform for PHP. You model your domain; Jardis generates the production-ready hexagonal code (DTOs, Command/Query handlers, repositories, persistence). This package is part of the open-source foundation that generated code runs on.

A PSR-3 logger for PHP with a pipeline of 20+ handlers, 7 formatters, and 6 enrichers. Configure everything through a fluent `LoggerBuilder` — the resulting `Logger` is immutable after construction. Smart handlers for production: `LogFingersCrossed` buffers until an error occurs, `LogSampling` reduces noise at high volume, `LogConditional` routes by content. One `LoggerBuilder` context per bounded context keeps logs cleanly separated.

---

Features
--------

[](#features)

- **20+ Handlers** — File, Console, Slack, Teams, Redis, Kafka, RabbitMQ, Loki, Database, Email, Webhook, Syslog, and more
- **Smart Handlers** — `LogFingersCrossed` (buffer-on-error), `LogSampling` (volume reduction), `LogConditional` (rule-based routing)
- **Fluent Builder** — `LoggerBuilder` chains handler registration; `getLogger()` returns an immutable `Logger`
- **Auto-Enrichment** — `LogDateTime`, `LogUuid`, `LogMemoryUsage`, `LogMemoryPeak`, `LogClientIp`, `LogWebRequest` added per handler
- **7 Formatters** — `LogJsonFormat`, `LogLineFormat`, `LogHumanFormat`, `LogSlackFormat`, `LogTeamsFormat`, `LogLokiFormat`, `LogBrowserConsoleFormat`
- **Named Handlers** — Retrieve any handler at runtime via `$logger->getHandler('name')`
- **Error Resilience** — One failing handler never stops the others; optional error callback via `setErrorHandler()`
- **Context Separation** — Each `LoggerBuilder` instance scopes its handlers to a named bounded context

---

Installation
------------

[](#installation)

```
composer require jardisadapter/logger
```

Quick Start
-----------

[](#quick-start)

```
use JardisAdapter\Logger\LoggerBuilder;
use Psr\Log\LogLevel;

// Console + file in two lines
$logger = (new LoggerBuilder('OrderService'))
    ->addConsole(LogLevel::DEBUG)
    ->addFile(LogLevel::INFO, '/var/log/orders.log')
    ->getLogger();

$logger->info('Order created', ['order_id' => 4711]);
$logger->error('Payment failed', ['order_id' => 4711, 'reason' => 'Card declined']);
```

Advanced Usage
--------------

[](#advanced-usage)

```
use JardisAdapter\Logger\LoggerBuilder;
use JardisAdapter\Logger\Handler\LogFile;
use Psr\Log\LogLevel;

// Production setup: file baseline + Slack alerts + FingersCrossed buffer + Sampling
$fileHandler = new LogFile(LogLevel::DEBUG, '/var/log/app.log');

$logger = (new LoggerBuilder('PaymentService'))
    // Always write DEBUG and above to file
    ->addHandler($fileHandler)

    // Alert on Slack for CRITICAL and above
    ->addSlack(
        logLevel: LogLevel::CRITICAL,
        webhookUrl: 'https://hooks.slack.com/services/...',
        name: 'slack-alerts'
    )

    // Buffer all messages; flush everything to file only when ERROR is triggered
    ->addFingersCrossed(
        wrappedHandler: $fileHandler,
        activationLevel: LogLevel::ERROR,
        bufferSize: 200,
        name: 'fingers-crossed'
    )

    // Reduce INFO noise to 10 % under load
    ->addSampling(
        wrappedHandler: $fileHandler,
        strategy: 'rate',
        config: ['rate' => 10],
        name: 'sampler'
    )

    ->getLogger();

$logger->info('Checkout started', ['session' => 'abc123']);
$logger->error('Stripe timeout', ['attempt' => 3]);

// Retrieve a named handler at runtime
$slackHandler = $logger->getHandler('slack-alerts');
```

Documentation
-------------

[](#documentation)

Full documentation, guides, and API reference:

**[docs.jardis.io/en/adapter/logger](https://docs.jardis.io/en/adapter/logger)**

License
-------

[](#license)

This package is licensed under the [MIT License](LICENSE.md).

---

**[Jardis](https://jardis.io)** · [Documentation](https://docs.jardis.io) · [Headgent](https://headgent.com)

AI-Assisted Development
-----------------------

[](#ai-assisted-development)

This package ships with a skill for Claude Code, Cursor, Continue, and Aider. Install it in your consuming project:

```
composer require --dev jardis/dev-skills
```

More details:

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance95

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

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 ~2 days

Total

5

Last Release

22d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e07a1b668e9e01ee6d1b85de7b3be1c2513f68aae9494b2011d1592104d5daa0?d=identicon)[jardis](/maintainers/jardis)

---

Top Contributors

[![Headgent](https://avatars.githubusercontent.com/u/245725954?v=4)](https://github.com/Headgent "Headgent (7 commits)")

---

Tags

domain-driven-designhexagonal-architecturejardislog-handlersloggingphppsr-3psr-3phploggingloggerDomain Driven Designdddhexagonal-architecturelog formatterjardislog-handlers

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jardisadapter-logger/health.svg)

```
[![Health](https://phpackages.com/badges/jardisadapter-logger/health.svg)](https://phpackages.com/packages/jardisadapter-logger)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k53](/packages/ecotone-ecotone)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

187557.3k3](/packages/wikimedia-parsoid)

PHPackages © 2026

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