PHPackages                             ostrolucky/semantic-monolog-handler - 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. ostrolucky/semantic-monolog-handler

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

ostrolucky/semantic-monolog-handler
===================================

Opinionated Monolog FingersCrossed handler which bypasses fingers-crossed behaviour for some primary channels

0.1.1(11mo ago)132MITPHPPHP &gt;=8.1CI passing

Since Apr 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/ostrolucky/semantic-monolog-handler)[ Packagist](https://packagist.org/packages/ostrolucky/semantic-monolog-handler)[ RSS](/packages/ostrolucky-semantic-monolog-handler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

Semantic Monolog Handler
========================

[](#semantic-monolog-handler)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f71f645a9a58b2ca7d49a2fc60ade7a0b648b6cbe6e7b0e9c7543c0f4c9bb424/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7374726f6c75636b792f73656d616e7469632d6d6f6e6f6c6f672d68616e646c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ostrolucky/semantic-monolog-handler)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://github.com/ostrolucky/semantic-monolog-handler/actions/workflows/continuous-integration.yaml/badge.svg)](https://github.com/ostrolucky/semantic-monolog-handler/actions/workflows/continuous-integration.yaml)

This is a [FingersCrossed handler](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/FingersCrossedHandler.php) that fills a missing gap in Monolog configuration:

It allows to have "primary" channels. If log is being written to one of these "primary" channels, it *skips fingers crossed behaviour*. This is combined with support for a Log Level. So you can still apply fingers crossed behaviour to message from primary channel, if it has low severity.

Best real world scenario of this is to be able to rely on &gt;= INFO "app" logs always being written, no matter if there was an error or not (and if there was an error, ensure these log entries are not written twice).

This is something that's [impossible to configure](https://github.com/symfony/monolog-bundle/issues/375) without writing custom handler, unless you are fine with duplicate log entries.

Install
-------

[](#install)

Via [Composer](https://getcomposer.org/doc/00-intro.md)

```
composer require ostrolucky/semantic-monolog-handler
```

Example configuration
---------------------

[](#example-configuration)

Handler configured following way will write all the logs to standard error output if any of the logs reach "ERROR" level, which is a standard FingersCrossed behaviour.

However, on top of it, it will also immediately print logs from "app" channel, unless they are under "DEBUG" level - without triggering FingersCrossed handler (which would flush all the logs).

```
use Monolog\Level;
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
use Monolog\Handler\StreamHandler;
use Ostrolucky\SemanticMonologHandler;

$logger = new SemanticLogHandler(
    innerHandler: new StreamHandler(STDERR),
    primaryChannels: ['app' => Level::Info],
    activationStrategy: new ErrorLevelActivationStrategy(Level::Error),
);
```

Example Symfony Monolog configuration
-------------------------------------

[](#example-symfony-monolog-configuration)

Above PHP configuration can be reflected in Symfony like so:

monolog.yaml:

```
monolog:
  handlers:
    main:
      type: service
      id: Ostrolucky\SemanticMonologHandler\SemanticLogHandler

services:
  Ostrolucky\SemanticMonologHandler\SemanticLogHandler:
    autoconfigure: true
    arguments:
      - !service
          class: Monolog\Handler\StreamHandler
          arguments:
            - !php/const STDERR
      - app: !php/enum Psr\Log\LogLevel\Level::Error
      - !service
          class: Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy
          arguments: [!php/enum Psr\Log\LogLevel\Level::Error]
```

Licensing
---------

[](#licensing)

MIT license. Please see [License File](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

2

Last Release

340d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f56471f595636876f95264fa5c455d611329a4820193f88d22e83a5bd900292?d=identicon)[ostrolucky](/maintainers/ostrolucky)

---

Top Contributors

[![ostrolucky](https://avatars.githubusercontent.com/u/496233?v=4)](https://github.com/ostrolucky "ostrolucky (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ostrolucky-semantic-monolog-handler/health.svg)

```
[![Health](https://phpackages.com/badges/ostrolucky-semantic-monolog-handler/health.svg)](https://phpackages.com/packages/ostrolucky-semantic-monolog-handler)
```

###  Alternatives

[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k189.7M257](/packages/symfony-monolog-bridge)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M81](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M516](/packages/illuminate-log)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)

PHPackages © 2026

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