curruwilla / console-pretty-log
为 CLI 应用提供简单且可定制的控制台日志输出。
1.4
2023-11-08 16:16 UTC
Requires
- php: >=7.4
- ext-iconv: *
README
为 CLI 应用提供简单且可定制的控制台日志输出。
亮点
- 简单安装(安装简单)
- 非常容易自定义文本输出(非常容易自定义文本输出)
- Composer 就绪并符合 PSR-12 标准(Composer 就绪并符合 PSR-12 标准)
安装
通过 Composer 提供上传器
"curruwilla/console-pretty-log": "^1.0"
或者运行
composer require curruwilla/console-pretty-log
文档
查看示例文件。
如果您在使用 textInitial 时定义了列的大小,请务必输入大小。
示例
use ConsolePrettyLog\Background; use ConsolePrettyLog\Color; use ConsolePrettyLog\Font; use ConsolePrettyLog\Line; $line = new Line(); $line->columnsSize([15, 75, 10]); // <-- Use to keep information aligned //$line->separator('-'); <-- Default value: '|' //$line->paddingCharacter(' '); <-- Default value: '.' //$line->enableDate(false); <-- Default value: true //$line->dateFormat("d/m/Y H:i"); <-- Default value: 'Y-m-d H:i:s' //$line->textInitial('LOG', [Color::RED, Font::BOLD]); <-- Include text at the beginning of every line //$line->textInitial('IMPORTANT', [Font::BOLD]); <-- Include text at the beginning of every line $line ->text('Account 1', [Font::BOLD, Font::ITALIC]) ->text('Delivery made successfully', [Color::WHITE]) ->text('Success', [Color::GREEN]) ->print(); $line ->text('Account 2', [Font::BOLD]) ->text('Opps, something went wrong with the delivery, please see the log', [Color::WHITE]) ->text('Error', [Background::RED]) ->print(); $line ->text('Account 3', [Font::BOLD]) ->text('Payment made successfully', [Color::WHITE, Font::ITALIC]) ->text('SUCCESS', [Background::GREEN]) ->print(); $line ->text('Account 1', [Font::BOLD]) ->text('Payment made successfully', [Color::WHITE]) ->text('INFO', [Background::BLUE]) ->print();
CLI 结果
枚举选项
贡献
有关详细信息,请参阅 CONTRIBUTING。
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。