bitandblack/process-log 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bitandblack/process-log

Composer 安装命令:

composer require bitandblack/process-log

包简介

Helps logging multiple and possibly asynchronously running processes

README 文档

README

PHP from Packagist Total Downloads License

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固