volnix/jobber 问题修复 & 功能扩展

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

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

volnix/jobber

Composer 安装命令:

composer require volnix/jobber

包简介

A slim library for printing typical CLI job output.

README 文档

README

Build Status Downloads Latest Stable Version Code Coverage

Jobber is a super-slim library for printing output from a CLI job. It supports command-line colors through the use of kevinlebrun/colors.php, a well-revered CLI color library.

It was built with simplicity in mind, as printing job output should be the least of your worries when building CLI-based scripts.

Example output from Jobber

***************************************************
2015-01-23 15:52:35 - Starting test_name

INFO: 2015-01-23 15:52:35 - foo
WARNING: 2015-01-23 15:52:35 - bar
SUCCESS: 2015-01-23 15:52:35 - baz
ERROR: 2015-01-23 15:52:35 - qux

2015-01-23 15:52:35 - Execution Time: 0.0 seconds / Peak memory usage: 3.22 Mb
***************************************************

Installation

Command line:

composer require volnix/jobber:~1.0

composer.json:

{
    "name": "your/application",
    "require": {
        "volnix/jobber": "~1.0"
    }
}

Usage

Typically the printer (Volnix/Jobber/Printer) will be started, then stopped. The start method prints out the job name and and some asterisks to fence off this job's output. The stop method prints memory usage, runtime, and more fences.

use Volnix/Jobber/Printer;

Printer::start('my_job_name');
Printer::info('Something happened, but it is not super important.');
Printer::stop();

Jobber also supports getting the output out of the printer in plain-text. This is especially useful for logging job output somewhere.

Printer::start('my_job_name');
Printer::info('Something happened, but it is not super important.');
Printer::stop();

$my_logger->info(Printer::getOutput());

All message types:

  • Info (Printer::info())
  • Warning (Printer::warning())
  • Success (Printer::success())
  • Error (Printer::error())
  • Fatal (Printer::fatal())
    • Note: fatal is merely an alias for error and stop in one call

If you desire to toggle verbosity on your job, this is supported. This will only disable info messages, while still allowing others to come through.

// turn off verbosity, disabling info messages
Printer::setVerbosity(false);

Note: info messages will still be returned when calling Printer::getOutput() for logging purposes

If you desire to run multiple job "sessions" in one command, you can reset the printer.

// do job 1
Printer::start('job_number_1');
// do something in your code...
Printer::success('Something good happened.');
Printer::stop();

// reset the printer
Printer::reset();

// start job 2
Printer::start('job_number_2');
// ...

Finally, you may use sprintf-style messages as well by passing a tokenized (%s, %d, etc.) string as your first argument and an array of tokens as your second.

// printing with tokens
Printer::start('something job');
Printer::info('Exported %d records to %s.', [10, '/filepath/something/here.txt']); // "Exported 10 records to /filepath/something/here.txt"

volnix/jobber 适用场景与选型建议

volnix/jobber 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.39k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-26