PHPackages                             gamez/psr-testlogger - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. gamez/psr-testlogger

Abandoned → [beste/psr-testlogger](/?search=beste%2Fpsr-testlogger)ArchivedLibrary[Testing &amp; Quality](/categories/testing)

gamez/psr-testlogger
====================

PSR-3 compliant test logger for developers who like tests and want to check if their application logs messages as they expect.

3.0.0(7y ago)9196.9k↓29%111MITPHPPHP ^7.0

Since Aug 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jeromegamez/php-psr-testlogger)[ Packagist](https://packagist.org/packages/gamez/psr-testlogger)[ RSS](/packages/gamez-psr-testlogger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (11)

PSR Test Logger
===============

[](#psr-test-logger)

PSR-3 compliant test logger for developers who like tests and want to check if their application logs messages as they expect.

**This package was superseded by [beste/psr-testlogger](https://github.com/beste/psr-testlogger).**

[![Packagist](https://camo.githubusercontent.com/b358d9dfe933438de255c1be4d33742fd92b2c0557128397bf3a243b651ea4f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67616d657a2f7073722d746573746c6f676765722e737667)](https://packagist.org/packages/gamez/psr-testlogger)![Supported PHP version](https://camo.githubusercontent.com/b66a26f665dacfb66c60a54dee754935b04f851bc1eba99221e113787e0c4463/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f67616d657a2f7073722d746573746c6f676765722e737667)[![Build Status](https://camo.githubusercontent.com/28e5aa5a29c6f2f9c3930feb7a35afc320b15a52aa661a9350cd064f1dc7694f/68747470733a2f2f7472617669732d63692e6f72672f6a65726f6d6567616d657a2f7068702d7073722d746573746c6f676765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jeromegamez/php-psr-testlogger)[![GitHub license](https://camo.githubusercontent.com/6137d96f8a5b04c682b4e02c9b6908af700b1e3ad2da2a1c461cc382ae727993/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a65726f6d6567616d657a2f7068702d7073722d746573746c6f676765722e737667)](https://github.com/jeromegamez/php-psr-testlogger/blob/master/LICENSE)![Total Downloads](https://camo.githubusercontent.com/94dd7692c1be31e816b1eb4dbf777bef287ca6eeca5618455a6c4bcb234654b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67616d657a2f7073722d746573746c6f676765722e737667)

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

[](#installation)

```
composer require --dev gamez/psr-testlogger

```

Usage
-----

[](#usage)

Inject an instance of `Gamez\Psr\Log\TestLogger` into your Subject Under Test instead of your regular logger.

```
use Psr\Log\LoggerInterface;

class SubjectUnderTest
{
    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function execute()
    {
        $this->logger->info('Message with a {placeholder}', ['placeholder' => 'value']);
        $this->logger->emergency('This {placeholder} will not be replaced.');
    }
}
```

```
use Gamez\Psr\Log\TestLogger;
use PHPUnit\Framework\TestCase;

class MyTest extends TestCase
{
    /**
     * @var TestLogger
     */
    private $logger;

    /**
     * @var SubjectUnderTest
     */
    private $sut;

    protected function setUp()
    {
        $this->logger = new TestLogger();
        $this->sut = new SubjectUnderTest($this->logger);
    }

    public function testLogging()
    {
        $this->sut->execute();

        $log = $this->logger->log;

        $this->assertTrue($log->has('Message with a value'));
        $this->assertTrue($log->hasRecordsWithContextKey('foo'));
        $this->assertFalse($log->hasRecordsWithContextKeyAndValue('foo', 'unwanted'));
        // This will break
        $this->assertFalse($log->hasRecordsWithUnreplacedPlaceholders());
    }
}
```

You can find all available helper methods in the [`Gamez\Psr\Log\Log` class](src/Log.php). If it doesn't provide a method you need, you can use your own filters:

```
use Gamez\Psr\Log\Record;
use Gamez\Psr\Log\TestLogger;
use PHPUnit\Framework\TestCase;

class MyTest extends TestCase
{
    /**
     * @var TestLogger
     */
    private $logger;

    /**
     * @var SubjectUnderTest
     */
    private $sut;

    protected function setUp()
    {
        $this->logger = new TestLogger();
        $this->sut = new SubjectUnderTest($this->logger);
    }

    public function testSomethingSpecial()
    {
        $filteredLog = $this->logger->log->filter(function (Record $record) {
            // Matches messages with only numbers
            return ctype_digit($record->message);
        });

        $this->assertCount(0, $filteredLog);
    }
}
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 92.1% 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 ~129 days

Recently: every ~103 days

Total

9

Last Release

2899d ago

Major Versions

1.x-dev → 2.0.02017-05-13

2.0.0 → 3.0.02018-06-11

PHP version history (2 changes)1.0.5PHP &gt;=5.4

2.0.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8685cf532053a084f1eade7b7da00a512c02676e65f1f1bdec73d4978030a47d?d=identicon)[jeromegamez](/maintainers/jeromegamez)

---

Top Contributors

[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (35 commits)")[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (2 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (1 commits)")

---

Tags

loggerphpphp-7php7phpunitpsr-3testingtestspsrlogpsr-3phpunittesttests

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/gamez-psr-testlogger/health.svg)

```
[![Health](https://phpackages.com/badges/gamez-psr-testlogger/health.svg)](https://phpackages.com/packages/gamez-psr-testlogger)
```

###  Alternatives

[colinodell/psr-testlogger

PSR-3 compliant test logger based on psr/log v1's, but compatible with v2 and v3 too!

1712.1M47](/packages/colinodell-psr-testlogger)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[zenstruck/assert

Standalone, lightweight, framework agnostic, test assertion library.

8214.9M8](/packages/zenstruck-assert)

PHPackages © 2026

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