PHPackages                             nostadt/psr3-log-context - 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. nostadt/psr3-log-context

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

nostadt/psr3-log-context
========================

Log-Context Made Easy

1.0.1(2y ago)01.1k1MITPHPPHP &gt;=8.1

Since Aug 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/nostadt/php-psr3-log-context)[ Packagist](https://packagist.org/packages/nostadt/psr3-log-context)[ Docs](https://github.com/nostadt/php-psr3-log-context/)[ RSS](/packages/nostadt-psr3-log-context/feed)WikiDiscussions development Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

PSR-3 Log-Context - Structured PSR-3 Logging
============================================

[](#psr-3-log-context---structured-psr-3-logging)

[![CI Process](https://github.com/nostadt/php-psr3-log-context/actions/workflows/default.yml/badge.svg)](https://github.com/nostadt/php-psr3-log-context/actions/workflows/default.yml)[![packagist.org](https://camo.githubusercontent.com/02d06107f2498b7c2ff40225a5569f4d877a673ec9f3c35770d9583258f84574/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f73746164742f707372332d6c6f672d636f6e74657874)](https://packagist.org/packages/nostadt/psr3-log-context)

Preamble
--------

[](#preamble)

Especially for larger projects logging is essential. You do want to have all the data you need when looking in the past. Nothing is worse than having a serious issue on the production system but lacking of helpful context information. This small package makes it easy to log in a structured manner without cluttering your code.

Available classes and interface
-------------------------------

[](#available-classes-and-interface)

ClassDescription`LogData`Key=&gt;Value combo to forbid bad values`LogContext`Storage for `LogData` and `toArray` method that will be passed as 2nd argument`LogContextConvertibleInterface`Make any custom class LogContext compatible.**Further link/s**

-

Examples
--------

[](#examples)

**Use LogContext::createFromException**

This is the recommended way when dealing with Exceptions, unless they implement `LogContextConvertibleInterface`.

```
