{"id":13813669,"url":"https://github.com/cooperhammond/python-draftlog","last_synced_at":"2025-10-27T19:31:58.435Z","repository":{"id":57423933,"uuid":"85147587","full_name":"cooperhammond/python-draftlog","owner":"cooperhammond","description":":scroll: Fancy logs with expandable tools. Bring life to your terminal!","archived":false,"fork":false,"pushed_at":"2017-04-16T00:34:12.000Z","size":58,"stargazers_count":86,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T19:03:27.532Z","etag":null,"topics":["cli","console","logging","python","terminal"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/draftlog","language":"Python","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/cooperhammond.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-16T03:19:38.000Z","updated_at":"2024-10-28T18:13:51.000Z","dependencies_parsed_at":"2022-08-30T02:11:12.855Z","dependency_job_id":null,"html_url":"https://github.com/cooperhammond/python-draftlog","commit_stats":null,"previous_names":["kepoorhampond/python-draftlog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooperhammond%2Fpython-draftlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooperhammond%2Fpython-draftlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooperhammond%2Fpython-draftlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooperhammond%2Fpython-draftlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cooperhammond","download_url":"https://codeload.github.com/cooperhammond/python-draftlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251813213,"owners_count":21648041,"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","logging","python","terminal"],"created_at":"2024-08-04T04:01:25.089Z","updated_at":"2025-10-27T19:31:58.365Z","avatar_url":"https://github.com/cooperhammond.png","language":"Python","readme":"# Draftlog\n\u003e :scroll: Fancy logs with expandable tools. Bring life to your terminal!\n\n[![demo](http://i.imgur.com/rWE21Ts.gif)](http://i.imgur.com/rWE21Ts.gif)\n\n[![License: MIT](https://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://mit-license.org/)\n[![Build Status](https://img.shields.io/travis/kepoorhampond/python-draftlog/master.svg?style=flat-square)](https://travis-ci.org/kepoorhampond/python-draftlog)\n[![PyPI](https://img.shields.io/badge/pypi-draftlog-blue.svg?style=flat-square)](https://pypi.python.org/pypi/draftlog)\n[![Say Thanks](https://img.shields.io/badge/say-thanks-ff69b4.svg?style=flat-square)](https://saythanks.io/to/kepoorhampond)\n\nA module useful for CLI's, logs and pretty much any cool multi-line python tool.\n\nAll inspiration goes to [Ivan Seidel](https://github.com/ivanseidel) with [`node-draftlog`](https://github.com/ivanseidel/node-draftlog).\n\nWorks with Python 2 and 3.\n\n## Install\n```\n$ pip install draftlog\n```\n\n## Intro Example\nHere's about the simplest program with `draftlog` that actually does something:\n```python\nimport draftlog\nimport time\n\ndraft = draftlog.inject()\n\nprint (\"The line below me will be updated!\")\nupdate_me = draft.log(\"I will be updated!\")\nprint (\"The line above me will be updated!\")\n\ntime.sleep(3)\n\nupdate_me.update(\"I've been updated!\")\n```\n\nHere's a more complicated program: a scrolling banner . If you want to see some more examples in this thread, check out the  [`examples`](https://github.com/kepoorhampond/python-draftlog/tree/master/examples) folder!\n```python\nimport draftlog\n\ndraft = draftlog.inject()\n\nclass Banner:\n    def __init__(self, string):\n        self.string = string\n        self.counter = 0\n    def scroll(self):\n        if self.counter \u003e= 50:\n            # This is what exits out of the loop in:\n            # \"draft.log().set_interval\"\n            raise draftlog.Exception\n        self.counter += 1\n        self.string = self.string[1:] + self.string[0]\n        return self.string\n\nstring = \"  Wow! Banners!     This is so cool!     All with draftlog!   \"\n\nprint (\"*\" * len(string))\nbanner = draft.log()\nprint (\"*\" * len(string))\n\nbanner.set_interval(Banner(string).scroll, 0.1)\n\ndraft.start()\n\n# You can still print stuff after starting the draft as well:\nimport time\ntime.sleep(2)\nprint (\"Wow, some more text!\")\n```\n\n`set_interval` is a function that takes another function and the time to wait. It overwrites the `draft.log()` line with whatever the function returns. The function will stop being called once it `raises draftlog.Exception`. `draft.start()` will actually start all intervals that have been set.\n\n### How\n`draft.log()` creates a `DraftLog` object that keeps track of what line it was created on. You can call `update(text)` on it to update the line that it's set on.\n\n`draft.log().set_interval(function, time)` primes an interval in a background threading process called `DaemonDrafter`. When `draft.start()` is called, it generates interval timing based off of the time specified and then runs it in \"frames.\"\n\nSince I've made the program open-ended, you can create a lot (see the [`examples`](https://github.com/kepoorhampond/python-draftlog/tree/master/examples) folder) of stuff.\n\n## Questions\nIf you still have questions or need some help, check out the [wiki](https://github.com/kepoorhampond/python-draftlog/wiki/) or email me at `kepoorh@gmail.com`, all feedback is appreciated!","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooperhammond%2Fpython-draftlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcooperhammond%2Fpython-draftlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooperhammond%2Fpython-draftlog/lists"}