{"id":15482211,"url":"https://github.com/aydinhassan/progress-bar-log","last_synced_at":"2025-04-15T11:03:40.392Z","repository":{"id":19047814,"uuid":"85983682","full_name":"AydinHassan/progress-bar-log","owner":"AydinHassan","description":"A component to display a progress bar and last X logs at the same time.","archived":false,"fork":false,"pushed_at":"2022-06-01T10:48:49.000Z","size":23,"stargazers_count":41,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-12-19T15:02:16.513Z","etag":null,"topics":["cli","console","error-handling","logging","php","progress-bar"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AydinHassan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-23T18:23:06.000Z","updated_at":"2023-09-19T01:52:50.000Z","dependencies_parsed_at":"2022-07-23T02:16:14.051Z","dependency_job_id":null,"html_url":"https://github.com/AydinHassan/progress-bar-log","commit_stats":null,"previous_names":[],"tags_count":7,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AydinHassan%2Fprogress-bar-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AydinHassan%2Fprogress-bar-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AydinHassan%2Fprogress-bar-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AydinHassan%2Fprogress-bar-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AydinHassan","download_url":"https://codeload.github.com/AydinHassan/progress-bar-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249058368,"owners_count":21205910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","console","error-handling","logging","php","progress-bar"],"created_at":"2024-10-02T05:08:28.222Z","updated_at":"2025-04-15T11:03:40.372Z","avatar_url":"https://github.com/AydinHassan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eProgress Bar Log\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eDisplay a progress bar and a portion of a log at the same time on the CLI!\u003c/p\u003e\n\n[![Preview](https://asciinema.org/a/dnyvr047wc0dfdrbalalau38n.png)](https://asciinema.org/a/dnyvr047wc0dfdrbalalau38n)\n\nClick the image above to see it in action.\n\n## Installation\n\n```sh\n$ composer require trash-panda/progress-bar-log\n```\n\n## Use cases\n\nOriginally I wanted this for long running import/export work. Being able to see a subset of the most recent log\nentries and also still see the progress and memory usage without scrolling the terminal. I figured it might be useful for \nsome other people too.\n\n## Usage\n\n```php\n\u003c?php\n\nuse Psr\\Log\\LogLevel;\nuse TrashPanda\\ProgressBarLog\\ProgressBarLog;\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n//The first parameter is the number of log lines to be displayed. The newest entries will be displayed - like a tail.\n//The second parameter is the maximum number of steps for the progress bar\n$progressLog = new ProgressBarLog(6, 10);\n$progressLog-\u003estart();\n\n//advance the progress bar by one\n$progressLog-\u003eadvance();\n\n//Add a log line - the first parameter is a psr/log severity constant\n//you can pass whatever you want there - but if it is a psr/log constant then the severity is colored accordingly\n$progressLog-\u003eaddLog(LogLevel::CRITICAL, 'Some mission critical error');\n```\n\nSee `example.php` for a working script:\n\n```sh\ngit clone git@github.com:AydinHassan/progress-bar-log.git\ncd progress-bar-log\nphp example.php\n```\n\n### Customising the progress bar\n\nThe underlying progress bar is an instance of `\\Symfony\\Component\\Console\\Helper\\ProgressBar`.\n\nYou can modify the settings of the progress bar by getting access to the instance via `getProgressBar()`:\n\n```php\n\u003c?php\n\nuse TrashPanda\\ProgressBarLog\\ProgressBarLog;\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n$progressLog = new ProgressBarLog(6, 10);\n$progressLog-\u003egetProgressBar()-\u003esetFormat('normal');\n$progressLog-\u003egetProgressBar()-\u003esetBarWidth(50);\n$progressLog-\u003estart();\n```\n\n## Running unit tests\n\n```sh\n$ composer test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faydinhassan%2Fprogress-bar-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faydinhassan%2Fprogress-bar-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faydinhassan%2Fprogress-bar-log/lists"}