承接 arnapou/psr-log 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arnapou/psr-log

最新稳定版本:v1.2.1

Composer 安装命令:

composer require arnapou/psr-log

包简介

Library - PSR-3.

README 文档

README

pipeline coverage

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

DateRef8.58.48.38.2
25/10/20251.2.x, main×××
24/11/20241.1.x×××
09/09/20241.0.x××

统计信息

  • 总下载量: 561
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-09