arnapou/psr-log
最新稳定版本:v1.2.1
Composer 安装命令:
composer require arnapou/psr-log
包简介
Library - PSR-3.
README 文档
README
KISS (Keep It Simple Stupid) PSR (PHP Standards Recommendations) classes.
Installation
composer require arnapou/psr-log
packagist 👉️ arnapou/psr-log
When it is worth to use this library
- you need simple decorators, proxies, adapters, ... about PSR's
- you need simple implementations covering the basics
Example PSR-3 Logger
File (rotation optional, inject your custom formatter or PSR-20 Clock Interface)
use Arnapou\Psr\Psr3Logger;
$logger = new Psr3Logger\FileLogger(
logDirectory: '/path/of/logs',
logName: 'app.log',
rotation: Psr3Logger\Utils\Rotation::Every12Hours,
);
Decorators
use Arnapou\Psr\Psr3Logger\Decorator;
$logger = new Decorator\FixedLevelLogger($decorated, 'info');
$logger = new Decorator\MinimumLevelLogger($decorated, 'info');
$logger = new Decorator\PrefixLogger($decorated, '[My-App]');
// The ContextLogger helps to gather the same context for a bunch of logs (DRY).
// It avoids repeating the context array everywhere.
$logger = new Decorator\ContextLogger($decorated);
$logger->addContext(['user_id' => 42, 'name' => 'John Doe']);
$logger->debug('Hello');
$logger->info('World');
Php versions
| Date | Ref | 8.5 | 8.4 | 8.3 | 8.2 |
|---|---|---|---|---|---|
| 25/10/2025 | 1.2.x, main | × | × | × | |
| 24/11/2024 | 1.1.x | × | × | × | |
| 09/09/2024 | 1.0.x | × | × |
统计信息
- 总下载量: 561
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-09