colinodell/psr-testlogger
Composer 安装命令:
composer require colinodell/psr-testlogger
包简介
PSR-3 compliant test logger based on psr/log v1's, but compatible with v2 and v3 too!
README 文档
README
PSR-3 compliant test logger based on psr/log v1's, but compatible with v2 and v3 too!
📦 Installation
This project requires PHP 8.0 or higher. To install it via Composer simply run:
$ composer require --dev colinodell/psr-testlogger
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
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
This library strictly follows SemVer using Symfony's BC Promise as a guide.
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.
colinodell/psr-testlogger 适用场景与选型建议
colinodell/psr-testlogger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.58M 次下载、GitHub Stars 达 18, 最近一次更新时间为 2022 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「logging」 「phpunit」 「test」 「logger」 「mock」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 colinodell/psr-testlogger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 colinodell/psr-testlogger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 colinodell/psr-testlogger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HiDev plugin for PHPUnit
Testing Suite For Lumen like Laravel does.
A cli tool which generates unit tests.
A Zend Framework module that sets up Monolog for logging in applications.
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
统计信息
- 总下载量: 13.58M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 21
- 依赖项目数: 42
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-17