PHPackages                             nextcloud/lognormalizer - 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. nextcloud/lognormalizer

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

nextcloud/lognormalizer
=======================

Parses variables and converts them to string so that they can be logged

v3.0.1(2mo ago)15.0k—0%[2 PRs](https://github.com/nextcloud/lognormalizer/pulls)AGPL-3.0-or-laterPHPPHP &gt;=8.1CI passing

Since Dec 2Pushed 1mo agoCompare

[ Source](https://github.com/nextcloud/lognormalizer)[ Packagist](https://packagist.org/packages/nextcloud/lognormalizer)[ Docs](https://github.com/interfasys/lognormalizer)[ RSS](/packages/nextcloud-lognormalizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (15)Used By (0)

Log Normalizer
--------------

[](#log-normalizer)

Parses variables and converts them to string so that they can be logged

Based on the [Monolog](https://github.com/Seldaek/monolog) formatter/normalizer.

How to use
----------

[](#how-to-use)

### Initialization in your class

[](#initialization-in-your-class)

```
use Nextcloud\LogNormalizer\Normalizer;

$normalizer = new Normalizer();
```

The constructor supports the following optional arguments

- `int $maxRecursionDepth`: The maximum depth at which you want to go in objects and arrays
- `int $maxArrayItems`: The maximum number of elements you want to show, when parsing an array or an object
- `string $dateFormat`: The format to apply to dates

### Format variables before logging them

[](#format-variables-before-logging-them)

This is what your logging function could look like

```
/**
 * Converts the variables in the received log message to string before
 * sending everything to the real logger
 *
 * @param string $level
 * @param string $message
 * @param array $variables
 *
 * @return mixed
 */
public function log($level, $message, array $variables= []) {
	array_walk($variables, [$this->normalizer, 'format']);

	// Then use your current PSR-3 compatible logging system
	$this->logger->log($level, $message, $variables);
}
```

And you would call it like this from another class

```
$myLogger->log('debug',
	'Logger test {var1}, {var2}',
	[
		'var1' => $var1,
		'var2' => $var2
		]
);
```

### Convert a single variable to a string

[](#convert-a-single-variable-to-a-string)

```
$normalizedVariable = $this->normalizer->format($variable);
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance87

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

4

Last Release

67d ago

Major Versions

v1.0.0 → v2.0.02025-10-24

v2.0.0 → v3.0.02025-12-17

PHP version history (3 changes)v1.0.0PHP &gt;=7.2.0

v2.0.0PHP &gt;=7.3.0

v3.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1374172?v=4)[Christoph Wurst](/maintainers/ChristophWurst)[@ChristophWurst](https://github.com/ChristophWurst)

---

Top Contributors

[![nickvergessen](https://avatars.githubusercontent.com/u/213943?v=4)](https://github.com/nickvergessen "nickvergessen (44 commits)")[![oparoz](https://avatars.githubusercontent.com/u/323220?v=4)](https://github.com/oparoz "oparoz (33 commits)")[![ChristophWurst](https://avatars.githubusercontent.com/u/1374172?v=4)](https://github.com/ChristophWurst "ChristophWurst (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![MorrisJobke](https://avatars.githubusercontent.com/u/245432?v=4)](https://github.com/MorrisJobke "MorrisJobke (2 commits)")

---

Tags

lognormalizer

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nextcloud-lognormalizer/health.svg)

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

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)

PHPackages © 2026

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