bitandblack/process-log
Composer 安装命令:
composer require bitandblack/process-log
包简介
Helps logging multiple and possibly asynchronously running processes
README 文档
README
Bit&Black Process Log.
Helps logging multiple and possibly asynchronously running processes by writing and reading their statuses in files.
Installation
This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/process-log.
Usage
1. Set up and update a process
Set up a process writer with a unique id and a folder where all the processes can be stored:
<?php
use BitAndBlack\ProcessLog\ProcessWriter;
$processWriter = new ProcessWriter(
'MyUniqueProcessId',
'/myProcessesFolder'
);
Create a status object and tell it something:
<?php
use BitAndBlack\ProcessLog\Status\Message;
$status = new Message('Here is my status');
You can also create a progress bar. Set it up with the total count of steps:
<?php
use BitAndBlack\ProcessLog\Status\Bar;
$status = new Bar(100);
For each step in your action store the status with the process writer:
<?php
foreach ($myAction as $step) {
/** Do something here... */
$processWriter->log($status);
}
If you have a progress bar you can update the count by calling $status->advance().
At the end clear the process:
<?php
$processWriter->clear();
2. Watch all processes
To watch the status of your processes you need to use the ProcessWatcher. Set it up with the folder of your processes and with an output object.
The output object needs to implement the Symfony\Component\Console\Output\OutputInterface.
<?php
use BitAndBlack\ProcessLog\ProcessWatcher;
$processWatcher = new ProcessWatcher(
'/myProcessesFolder',
$myOutputObject
);
After that, define in which interval you want to refresh the status output, define a initial wait time and start the watcher then.
The time is in microseconds here:
<?php
$processWatcher
->setInterval(1000000)
->setTimeOut(2000000)
->watch()
;
The watcher will run as long as there are files inside you processes folders and quit after that.
Help
If you have any questions, feel free to contact us under hello@bitandblack.com.
Further information about Bit&Black can be found under www.bitandblack.com.
bitandblack/process-log 适用场景与选型建议
bitandblack/process-log 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「logger」 「async」 「parallel」 「progress bar」 「Thread」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bitandblack/process-log 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bitandblack/process-log 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bitandblack/process-log 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
An async event for hyperf.
Workflow logger
HTTP request logger middleware for Laravel
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Laravel 5.x.x library for integration Monolog Sentry
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-11