{ "info": { "author": "Rahul R Bharadwaj", "author_email": "rahulbharadwaj033@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.0", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "# Rotating Text File\nA rotating file handler which rotates when YOU want it to, rather than based on bytes size. \n\n### When to use this module?\n- When you have that niche case of logs being written into some text file from several functions and you just want it to rotate without having to re-write all the write calls with some new package.\n\n### Why not use RotatingFileHandler provided by Python's logging module?\n- If you are thinking of logging, please use RotatingFileHandler. It provides doRollover method which does the same functionality but with all the logging APIs.\n- This module aims to solve cases of code where outputs were just being dumped into some file and over time the code grew so big that rotating the text file was needed without distrubing/refactoring the entire codebase.\n\n### Installation\n`pip install RotatingTextFile`\n\n### Usage:\n- Any existing code with text file can be replaced with the RotateTextFile constructor and a checker function.\n- Eg:\n\nIf you have some code like:\n```\nwith open(\"path/to/text/file\",\"w\") as fp:\n fp.write(\"some log\")\n```\nAll you have to do is:\n```\ndef condition():\n return some_variable==0\n\nwith RotateTextFile(\"path/to/text/file\",condition,10) as fp: #10 is backupCount as in RotatingFileHandler\n fp.write(\"some log\")\n``` \n\n- `condition` is called on every write. You can think of it as an analogy to a sort function which takes your `checking` function as an input.\n- `RotateTextFile` inherits `io.TextIOWrapper`, so to pass any arguments specific to `io.TextIOWrapper`'s constructor, just pass them as Keyword Arguments.\n- Since a file is rotated only on write, `RotateTextFile` constructor opens the file in `ab+` mode. Other supported modes are :`wb`. `mode` can be passed as:\n`RotateTextFile(\"path/to/text/file\",condition,10,'wb'):`\n- `backupCount` indicates how many backups a file can have before it is rotated.\n- Like `RotatingFileHandler` provided by Python's logging module, `RotateTextFile` guarentees that the file being written to will ALWAYS be `filename.log`\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Rahul-RB/RotatingTextFile", "keywords": "custom rotating file handler textfile logger", "license": "", "maintainer": "", "maintainer_email": "", "name": "RotatingTextFile", "package_url": "https://pypi.org/project/RotatingTextFile/", "platform": "", "project_url": "https://pypi.org/project/RotatingTextFile/", "project_urls": { "Homepage": "https://github.com/Rahul-RB/RotatingTextFile" }, "release_url": "https://pypi.org/project/RotatingTextFile/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A ZERO dependency rotating file handler which rotates when YOU want it to, rather than based on bytes size.", "version": "0.0.2" }, "last_serial": 5963454, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d17aa49450e7013b738e87acf720ef01", "sha256": "5f805416ef24aa2f830776a1ad04a33577f9ff81b593ce95c5b48c332493437c" }, "downloads": -1, "filename": "RotatingTextFile-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d17aa49450e7013b738e87acf720ef01", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15324, "upload_time": "2019-10-12T07:40:24", "url": "https://files.pythonhosted.org/packages/92/51/fe57c176b66e58e52b250abd499fa339967ae64a0c72db0216617b5d4787/RotatingTextFile-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70ede0ac716e546679ad79e370fddc78", "sha256": "b99334891900a8d66532212212270dd56465342e00c362b45efb9a2cc2613949" }, "downloads": -1, "filename": "RotatingTextFile-0.0.1.tar.gz", "has_sig": false, "md5_digest": "70ede0ac716e546679ad79e370fddc78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2863, "upload_time": "2019-10-12T07:40:28", "url": "https://files.pythonhosted.org/packages/6a/5c/d3d473155c964ef2ccf14c0a8327ff4387adb1039604b9dbe18b0331f400/RotatingTextFile-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5dfcf37b49ab101cee9384e03f66a4b5", "sha256": "a3b898045a6fe8e5dfbae996f0878e3be9398e2b7705fae182782bed89c9adf5" }, "downloads": -1, "filename": "RotatingTextFile-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5dfcf37b49ab101cee9384e03f66a4b5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15315, "upload_time": "2019-10-12T07:47:39", "url": "https://files.pythonhosted.org/packages/0c/df/27f28101fffc70d5084cdb8e65233bd20e984d65724ee6c30cc5d93aa851/RotatingTextFile-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0aca0256b35b3723d88ac3b16abf97b4", "sha256": "cc4fc829860b7934d79d6fcb8d8b91e9df86e5f76e9ecc231e3bee3c140a45e3" }, "downloads": -1, "filename": "RotatingTextFile-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0aca0256b35b3723d88ac3b16abf97b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2854, "upload_time": "2019-10-12T07:47:41", "url": "https://files.pythonhosted.org/packages/c5/e4/c42b44a7778dac9d090f95e9d6a4e29536e571fe2699e8f2d3168f5c4010/RotatingTextFile-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5dfcf37b49ab101cee9384e03f66a4b5", "sha256": "a3b898045a6fe8e5dfbae996f0878e3be9398e2b7705fae182782bed89c9adf5" }, "downloads": -1, "filename": "RotatingTextFile-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5dfcf37b49ab101cee9384e03f66a4b5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15315, "upload_time": "2019-10-12T07:47:39", "url": "https://files.pythonhosted.org/packages/0c/df/27f28101fffc70d5084cdb8e65233bd20e984d65724ee6c30cc5d93aa851/RotatingTextFile-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0aca0256b35b3723d88ac3b16abf97b4", "sha256": "cc4fc829860b7934d79d6fcb8d8b91e9df86e5f76e9ecc231e3bee3c140a45e3" }, "downloads": -1, "filename": "RotatingTextFile-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0aca0256b35b3723d88ac3b16abf97b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2854, "upload_time": "2019-10-12T07:47:41", "url": "https://files.pythonhosted.org/packages/c5/e4/c42b44a7778dac9d090f95e9d6a4e29536e571fe2699e8f2d3168f5c4010/RotatingTextFile-0.0.2.tar.gz" } ] }