PHPackages                             szemul/logging-error-handling - 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. szemul/logging-error-handling

Abandoned → [szemul/logging-error-handling-context](/?search=szemul%2Flogging-error-handling-context)ArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

szemul/logging-error-handling
=============================

Provides commonly usable error handlers and logging helpers and a common context to manage contextual data to be injected into errors and log messages.

1.0.1(4y ago)0346MITPHPPHP ^8.0

Since Aug 29Pushed 3y ago2 watchersCompare

[ Source](https://github.com/szemul/logging-error-handling)[ Packagist](https://packagist.org/packages/szemul/logging-error-handling)[ RSS](/packages/szemul-logging-error-handling/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

Logging-error handling
======================

[](#logging-error-handling)

[![CI pipeline](https://github.com/szemul/logging-error-handling/actions/workflows/php.yml/badge.svg)](https://github.com/szemul/logging-error-handling/actions/workflows/php.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/f2bffae76601699ddc19061130b5366b767a14793ff1ac77c0673f3cff3094d1/68747470733a2f2f636f6465636f762e696f2f67682f737a656d756c2f6c6f6767696e672d6572726f722d68616e646c696e672f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4b5a4a31334f46353737)](https://codecov.io/gh/szemul/logging-error-handling)

Deprecation notice
------------------

[](#deprecation-notice)

This package has been deprecated and has been split to 3 packages: szemul/logging-error-handling-context - Only contains the contexts szemul/sentry-error-handler - Only contains the sentry error handler szemul/monolog-logging-context - Only contains the context support for monolog

### Reasons for the deprecation

[](#reasons-for-the-deprecation)

This package couldn't require the correct versions of sentry and monolog, users of the package needed to require it themselves. With monolog version 3 the JsonFormatter's signatures changed and the package couldn't clearly say what version it supports without requiring all users to install both sentry and monolog even if it's not needed otherwise.

The new package organisation allows us to require sentry and monolog in the supported versions only in the more targeted packages.

### Migration to the new packages

[](#migration-to-the-new-packages)

Version 1 of the new packages is just a copy of the classes in this repository, however the base namespaces are different. So require the packages you need and update the namespaces. No other changes are needed for version 1.

Original readme
===============

[](#original-readme)

Provides commonly usable error handlers and logging helpers and a common context to manage contextual data to be injected into errors and log messages.

The following error handlers are available:

- SentryErrorHandler - for sending rich errors to Sentry

The following formatters are available for monolog:

- ContextAwareJsonFormatter - for sending rich log messages in JSON format via monolog

Context
-------

[](#context)

The context is useful for storing values used to enrich logs and errors. The context class supports switching contexts. When adding a new context, the existing values are preserved, and you can switch back to any previous context and recover the state (switching back drops any changes in any newer context).

Traits
------

[](#traits)

There are some helper traits provided to help with the bootstrapping process and configure the error handler and the JSON formatter.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Total

2

Last Release

1694d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e74721923742f5c04b8ccd5796e0a0e0e744fd004fbaae3c7813b27e125ae70?d=identicon)[szeber](/maintainers/szeber)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/szemul-logging-error-handling/health.svg)

```
[![Health](https://phpackages.com/badges/szemul-logging-error-handling/health.svg)](https://phpackages.com/packages/szemul-logging-error-handling)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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