PHPackages                             colinodell/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. colinodell/psr-testlogger

ActiveLibrary[Testing &amp; Quality](/categories/testing)

colinodell/psr-testlogger
=========================

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

v1.3.1(6mo ago)1712.1M—2%520MITPHPPHP ^8.0CI passing

Since Feb 17Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/colinodell/psr-testlogger)[ Packagist](https://packagist.org/packages/colinodell/psr-testlogger)[ Docs](https://github.com/colinodell/psr-testlogger)[ Fund](https://www.colinodell.com/sponsor)[ Fund](https://www.paypal.me/colinpodell/10.00)[ RSS](/packages/colinodell-psr-testlogger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (20)

psr-testlogger
==============

[](#psr-testlogger)

[![Latest Version](https://camo.githubusercontent.com/0d96fb51fd7b75eaf71e7b4a51d6f80ba580a6efff4f663966424fc4f910440e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6c696e6f64656c6c2f7073722d746573746c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/colinodell/psr-testlogger)[![Total Downloads](https://camo.githubusercontent.com/a178abd34cc736f88b42e30c289c9cff6d233a9291fcdcdc2014d451fc24fdbe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6c696e6f64656c6c2f7073722d746573746c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/colinodell/psr-testlogger)[![Software License](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/6a02f11295ae67ad0c2239a09e2f3ad5525341001bc6a2c1c733f9996588c268/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6c696e6f64656c6c2f7073722d746573746c6f676765722f74657374732e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/colinodell/psr-testlogger/actions?query=workflow%3ATests+branch%3Amain)[![Coverage Status](https://camo.githubusercontent.com/0f7f91109f812693419536d073a24f70f3be01a6016a941709558f7ca663648f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f636f6c696e6f64656c6c2f7073722d746573746c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/colinodell/psr-testlogger/code-structure)[![Quality Score](https://camo.githubusercontent.com/b3b63b88ee4cb7791dd8ce270bde77b9226039bd01258903893b4b9912f551f0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f6c696e6f64656c6c2f7073722d746573746c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/colinodell/psr-testlogger)[![Psalm Type Coverage](https://camo.githubusercontent.com/efcef6e9f2afec58953bfb689caad9f54908b1181c59672fc5df591608fb81c1/68747470733a2f2f73686570686572642e6465762f6769746875622f636f6c696e6f64656c6c2f7073722d746573746c6f676765722f636f7665726167652e737667)](https://shepherd.dev/github/colinodell/psr-testlogger)[![Sponsor development of this project](https://camo.githubusercontent.com/2e662697b46a37233abdd7e45373397aab0bd5206336533151cdf42455d81048/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f72253230746869732532307061636b6167652d2545322539442541342d6666363962342e7376673f7374796c653d666c61742d737175617265)](https://www.colinodell.com/sponsor)

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

📦 Installation
--------------

[](#-installation)

This project requires PHP 8.0 or higher. To install it via Composer simply run:

```
$ composer require --dev colinodell/psr-testlogger
```

Usage
-----

[](#usage)

This package provides a PSR-3 compliant logger useful for testing. Simply log messages to it like usual, and use one of the many available methods to perform assertions on the logged messages.

```
hasRecords(string|int $level): bool

hasEmergencyRecords(): bool
hasAlertRecords(): bool
hasCriticalRecords(): bool
hasErrorRecords(): bool
hasWarningRecords(): bool
hasNoticeRecords(): bool
hasInfoRecords(): bool
hasDebugRecords(): bool

hasRecord(string|array $record, string|int $level): bool

hasEmergency(string|array $record): bool
hasAlert(string|array $record): bool
hasCritical(string|array $record): bool
hasError(string|array $record): bool
hasWarning(string|array $record): bool
hasNotice(string|array $record): bool
hasInfo(string|array $record): bool
hasDebug(string|array $record): bool

hasRecordThatContains(string $message, string|int|null $level = null): bool

hasEmergencyThatContains(string $message): bool
hasAlertThatContains(string $message): bool
hasCriticalThatContains(string $message): bool
hasErrorThatContains(string $message): bool
hasWarningThatContains(string $message): bool
hasNoticeThatContains(string $message): bool
hasInfoThatContains(string $message): bool
hasDebugThatContains(string $message): bool

hasRecordThatMatches(string $regex, string|int|null $level = null): bool

hasEmergencyThatMatches(string $regex): bool
hasAlertThatMatches(string $regex): bool
hasCriticalThatMatches(string $regex): bool
hasErrorThatMatches(string $regex): bool
hasWarningThatMatches(string $regex): bool
hasNoticeThatMatches(string $regex): bool
hasInfoThatMatches(string $regex): bool
hasDebugThatMatches(string $regex): bool

hasRecordThatPasses(callable $predicate, string|int|null $level = null): bool

hasEmergencyThatPasses(callable $predicate): bool
hasAlertThatPasses(callable $predicate): bool
hasCriticalThatPasses(callable $predicate): bool
hasErrorThatPasses(callable $predicate): bool
hasWarningThatPasses(callable $predicate): bool
hasNoticeThatPasses(callable $predicate): bool
hasInfoThatPasses(callable $predicate): bool
hasDebugThatPasses(callable $predicate): bool

```

In addition to the standard PSR-3 log levels, this test logger also supports custom `string` and `int` levels when using `log()`. Other types are not supported.

Release Cycle
-------------

[](#release-cycle)

This library is considered stable. No new development is currently planned unless needed to fix issues or maintain compatibility with the psr/log library.

Issues and PRs for bug fixes are welcome and will be merged/released on an as-needed basis.

Backward Compatibility
----------------------

[](#backward-compatibility)

This library strictly follows SemVer using [Symfony's BC Promise](https://symfony.com/doc/current/contributing/code/bc.html) as a guide.

Reporting Security Issues
-------------------------

[](#reporting-security-issues)

Please report security issues directly to the library author instead of using the issue tracker. Contact info can be found in `composer.json`.

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance69

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.5% 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 ~339 days

Total

5

Last Release

195d ago

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

v1.2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4325b62a6ad366c731c3120595d861469be50f9da88df3ea99752c30ff98c179?d=identicon)[colinodell](/maintainers/colinodell)

---

Top Contributors

[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (41 commits)")[![jonathanjfshaw](https://avatars.githubusercontent.com/u/3512385?v=4)](https://github.com/jonathanjfshaw "jonathanjfshaw (13 commits)")[![JeanBaptisteRenard](https://avatars.githubusercontent.com/u/140425495?v=4)](https://github.com/JeanBaptisteRenard "JeanBaptisteRenard (2 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (1 commits)")[![kbond](https://avatars.githubusercontent.com/u/127811?v=4)](https://github.com/kbond "kbond (1 commits)")

---

Tags

psrlogphpunitunittestloggingmocklogger

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[timacdonald/log-fake

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

4235.9M56](/packages/timacdonald-log-fake)[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)[icecave/isolator

Dependency injection for global functions.

371.3M29](/packages/icecave-isolator)[elliotchance/concise

Concise is test framework for using plain English and minimal code, built on PHPUnit.

45223.8k4](/packages/elliotchance-concise)[diablomedia/phpunit-pretty-printer

A PHPUnit result printer that shows per-file test progress and execution times

78515.2k5](/packages/diablomedia-phpunit-pretty-printer)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)

PHPackages © 2026

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