{ "info": { "author": "Giuseppe Cuccu", "author_email": "giuseppe.cuccu@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Build Tools" ], "description": "# BruteLogger\n\nA brutish file logger for when you just need to `tee` your screen. Forks `stdout` to multiple handlers.\n\n## Notice\n\nLogging done right should use [`logging`](https://docs.python.org/3/library/logging.html), or the wonderful [`loguru`](https://github.com/Delgan/loguru).\n\n## Installation\n\n`pip install brutelogger`\n\n## Usage\n\n```python\nfrom brutelogger import BruteLogger\nBruteLogger.save_stdout_to_file()\n# Everything on screen from now on will be copied\n# to a timestamped file inside `./logs/`\n```\n\nMore options:\n\n```python\nfrom brutelogger import BruteLogger\nBruteLogger.save_stdout_to_file(path='captains_log', fname='stardate_41153.7',\n mode='wb', encoding='utf8', also_stderr=True)\nprint(\"Our destination is planet Deneb IV\")\n# => outputs both to terminal and to file `captains_log/stardate_41153.7` (in binary)\n```\n\nSee the implementation of `save_stdout_to_file` for advanced usage.\n\n\n## Applications\n\nThis library offers instead a brute redirect of everything that comes on screen to multiple handlers, typically including the original terminal and a log file. The goal is to maintain a hard copy of the output in case of failure, or for future processing.\n\nFor example, the original use case included multiple processes running asynchronously, each calling a C library which used `printf()` to deliver important algorithm statistics. These became easy to retrieve from the log file using regular expressions.\n\n\n## How does it work\n\nAny function (call, message) on (/to) the object is propagated verbatim with parameters to each and all handlers.\nFor example, calling `BruteLogger.save_stdout_to_file()` such as calling `sys.stdout.flush()` after using \nThis means that a call to `sys.stdout.flush()` will translate in calling `flush()` on both the terminal file handler and on the opened log file handler. Same goes for example with `close()` being called upon program termination.\n\n\n## Todo\n\n- Option to switch back `sys.__stdout__`\n- Add / remove handlers\n- Accessing handlers (e.g. calling `close()` only on the file log, not on the `__stdout__`)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/giuse/brutelogger/archive/0.1.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/giuse/brutelogger", "keywords": "logging tee", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "brutelogger", "package_url": "https://pypi.org/project/brutelogger/", "platform": "", "project_url": "https://pypi.org/project/brutelogger/", "project_urls": { "Bug Reports": "https://github.com/giuse/brutelogger/issues", "Download": "https://github.com/giuse/brutelogger/archive/0.1.2.tar.gz", "Homepage": "https://github.com/giuse/brutelogger", "Source": "https://github.com/giuse/brutelogger/" }, "release_url": "https://pypi.org/project/brutelogger/0.1.2/", "requires_dist": null, "requires_python": ">=3.6, <4", "summary": "A brutish file logger for when you just need to `tee` your screen.", "version": "0.1.2" }, "last_serial": 5699189, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "706b881677398d5b45127fd53edc699d", "sha256": "c607eb24a767e30dc93cf7cca75480d2a2380402448caa4b5093a4b77d589dd3" }, "downloads": -1, "filename": "brutelogger-0.1.0.tar.gz", "has_sig": false, "md5_digest": "706b881677398d5b45127fd53edc699d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6, <4", "size": 3335, "upload_time": "2019-07-16T22:07:22", "url": "https://files.pythonhosted.org/packages/df/81/871dc7205682741cdc1265b9f261e3dde141347736016ef80c40bd0f1bb3/brutelogger-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f6fd61545e799998b74d9729c21246f7", "sha256": "20f5eaf2549fb51abfef091fb1ef0beff72f203a010ecf8cd3b6b1b0efc24c67" }, "downloads": -1, "filename": "brutelogger-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f6fd61545e799998b74d9729c21246f7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6, <4", "size": 3341, "upload_time": "2019-08-14T15:00:02", "url": "https://files.pythonhosted.org/packages/a5/6f/dbdf1f5ab216dac14b8294304a3da7be0bd4104efe9fe4a1a7c584a386bc/brutelogger-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "87dde5ea971bfe47833e027206fce42b", "sha256": "2911fd4f80b4057b8bcdae59e3dd26ac24fd46b2a62e4fa72e634e893c047225" }, "downloads": -1, "filename": "brutelogger-0.1.2.tar.gz", "has_sig": false, "md5_digest": "87dde5ea971bfe47833e027206fce42b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6, <4", "size": 3345, "upload_time": "2019-08-19T16:02:30", "url": "https://files.pythonhosted.org/packages/34/a4/678345de1bb49536eab9431269fbdd5c5cc7316702e7b6438206fd3f1f73/brutelogger-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87dde5ea971bfe47833e027206fce42b", "sha256": "2911fd4f80b4057b8bcdae59e3dd26ac24fd46b2a62e4fa72e634e893c047225" }, "downloads": -1, "filename": "brutelogger-0.1.2.tar.gz", "has_sig": false, "md5_digest": "87dde5ea971bfe47833e027206fce42b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6, <4", "size": 3345, "upload_time": "2019-08-19T16:02:30", "url": "https://files.pythonhosted.org/packages/34/a4/678345de1bb49536eab9431269fbdd5c5cc7316702e7b6438206fd3f1f73/brutelogger-0.1.2.tar.gz" } ] }