承接 juanchosl/logger 相关项目开发

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

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

juanchosl/logger

Composer 安装命令:

composer require juanchosl/logger

包简介

Little logger using the PSR interfaces

关键字:

README 文档

README

Description

Little adapter to save log data using PSR3. This library have the availability of put the data log into distincts repositories or with different format. We can change the destination of the data, or his format, only changing the injected dependency.

We can create distincts log for differents cases, save it with an alias into the Debugger instance and call or inject any one into a any lib. In example, we can create a log for database queries, other for debug, other for errors...

Installation

Use composer in order to install it

composer require juanchosl/logger
composer update

How to use

First steps

Create or use provided Data Composers,

Using composers, you can create and design your own messages structure, you can convert to String (for save into files) or can convert to Array or Objects in order to save into tables.

Actually we have availables 3 types of Composers:

  • TextComposer
  • ArrayComposer
  • ObjectComposer
$composer = new TextComposer;

Create or use a provided repository

Is the message destination, you can use the same Composer for save data to few Repositories, mantaining the same structure for all, create an instance in order to put the composer

Actually we have availables 3 Repositories

  • FileRepository (needs to provide a filepath)
  • ScreenRepository (do ECHO, converting iterable entities with print_r, json_encode, casting to string or performing a var_dump)
  • StreamRepository, as Screen, convert variables, capturing it and send to a stream, as a body from a PSR Response
$repository = new FileRepository(PATH . DIRECTORY_SEPARATOR . 'error.log');
$repository->setComposer($composer);

Logger

Declare a Logger directly

$logger = new JuanchoSL\Logger\Logger($repository);
$logger->error("This is a message error");

Declare a Logger using the provided Debugger class

use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init();
$debugger->setLogger('errors', $logger);

//.... your code ...

Debugger::get('errors')->error("This is a message error");

Declaring few Loggers in order to save separated data

use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init()
    ->setLogger('errors', $logger)
    ->setLogger('database', new Logger((new ModelRepository())->setComposer(new ObjectComposer)));

//.... your code ...

Debugger::get('errors')?->error("This is a message error");
Debugger::get('database')?->debug($sql);

Error control

Initializing error or exception handlers

use JuanchoSL\Logger\Debugger;

$debugger = Debugger::init()->setLogger('errors', $logger)->initFailuresHandler('errors', E_ALL^E_USER_NOTICE);

Use declared Loggers for inject as dependecy into Libraries

use JuanchoSL\Logger\Debugger;
use JuanchoSL\Orm\Engine\Drivers\Mysqli;

$debugger = Debugger::init()
    ->setLogger('errors', $logger)
    ->setLogger('database', new Logger((new ModelRepository())->setComposer(new ObjectComposer)))
    ->initFailuresHandler('errors', E_ALL^E_USER_NOTICE);

$database = new Mysqli($credentials);
$database->setLogger($debugger->getLogger('database'));

juanchosl/logger 适用场景与选型建议

juanchosl/logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 378 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 09 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「log」 「debug」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 juanchosl/logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 juanchosl/logger 我们能提供哪些服务?
定制开发 / 二次开发

基于 juanchosl/logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 378
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 9
  • 推荐数: 1

GitHub 信息

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

其他信息

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