All Projects → AydinHassan → progress-bar-log

AydinHassan / progress-bar-log

Licence: MIT license
A component to display a progress bar and last X logs at the same time.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to progress-bar-log

Tqdm
A Fast, Extensible Progress Bar for Python and CLI
Stars: ✭ 20,632 (+46790.91%)
Mutual labels:  console, progress-bar
Stateviews
Create & Show progress, data or error views, the easy way!
Stars: ✭ 367 (+734.09%)
Mutual labels:  progress-bar, error-handling
Progress Activity
Easily add loading, empty and error states in your app.
Stars: ✭ 1,039 (+2261.36%)
Mutual labels:  progress-bar, error-handling
Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+1450%)
Mutual labels:  console, progress-bar
Laravel Console Logger
Logging and Notifications for Laravel Console Commands.
Stars: ✭ 79 (+79.55%)
Mutual labels:  console, error-handling
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: ✭ 238 (+440.91%)
Mutual labels:  console, error-handling
Yurnalist
An elegant console reporter, borrowed from Yarn
Stars: ✭ 88 (+100%)
Mutual labels:  console, progress-bar
laravel-console-spinner
Customized loading ⌛ spinner for Laravel Artisan Console.
Stars: ✭ 70 (+59.09%)
Mutual labels:  console, progress-bar
superagent-intercept
Add functions that will be called during end() e.g. for handling error conditions without having the same code all over the place.
Stars: ✭ 23 (-47.73%)
Mutual labels:  error-handling
pymailq
Simple mails queue management
Stars: ✭ 32 (-27.27%)
Mutual labels:  console
CustomProgress
自定义水平带百分比数字的进度条以及自定义圆形带百分比数字的进度条
Stars: ✭ 58 (+31.82%)
Mutual labels:  progress-bar
python-sdk
python sdk for FISCO BCOS
Stars: ✭ 53 (+20.45%)
Mutual labels:  console
console
HAL management console
Stars: ✭ 41 (-6.82%)
Mutual labels:  console
DelphiConsole
The Console class from C# ported to Delphi
Stars: ✭ 101 (+129.55%)
Mutual labels:  console
failure
An error handling package for Go.
Stars: ✭ 24 (-45.45%)
Mutual labels:  error-handling
result17
A rust like Result type for modern C++
Stars: ✭ 13 (-70.45%)
Mutual labels:  error-handling
Slim-Console
Slim Framework Console
Stars: ✭ 26 (-40.91%)
Mutual labels:  console
samples
Sample smart contract apps for Xooa PaaS.
Stars: ✭ 19 (-56.82%)
Mutual labels:  console
executor
A powerful "short-cutter" to your console to you and your team!
Stars: ✭ 21 (-52.27%)
Mutual labels:  console
failure
Error management
Stars: ✭ 1,448 (+3190.91%)
Mutual labels:  error-handling

Progress Bar Log

Display a progress bar and a portion of a log at the same time on the CLI!

Preview

Click the image above to see it in action.

Installation

$ composer require trash-panda/progress-bar-log

Use cases

Originally I wanted this for long running import/export work. Being able to see a subset of the most recent log entries and also still see the progress and memory usage without scrolling the terminal. I figured it might be useful for some other people too.

Usage

<?php

use Psr\Log\LogLevel;
use TrashPanda\ProgressBarLog\ProgressBarLog;

require_once __DIR__ . '/vendor/autoload.php';

//The first parameter is the number of log lines to be displayed. The newest entries will be displayed - like a tail.
//The second parameter is the maximum number of steps for the progress bar
$progressLog = new ProgressBarLog(6, 10);
$progressLog->start();

//advance the progress bar by one
$progressLog->advance();

//Add a log line - the first parameter is a psr/log severity constant
//you can pass whatever you want there - but if it is a psr/log constant then the severity is colored accordingly
$progressLog->addLog(LogLevel::CRITICAL, 'Some mission critical error');

See example.php for a working script:

git clone [email protected]:AydinHassan/progress-bar-log.git
cd progress-bar-log
php example.php

Customising the progress bar

The underlying progress bar is an instance of \Symfony\Component\Console\Helper\ProgressBar.

You can modify the settings of the progress bar by getting access to the instance via getProgressBar():

<?php

use TrashPanda\ProgressBarLog\ProgressBarLog;

require_once __DIR__ . '/vendor/autoload.php';

$progressLog = new ProgressBarLog(6, 10);
$progressLog->getProgressBar()->setFormat('normal');
$progressLog->getProgressBar()->setBarWidth(50);
$progressLog->start();

Running unit tests

$ composer test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].