{ "info": { "author": "Mick Koch", "author_email": "mick@kochm.co", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only" ], "description": "# logbook_aiopipe -- Multiprocess logbook logging for asyncio\n\n[Documentation](http://kchmck.github.io/pdoc/logbook_aiopipe/)\n\nThis package provides a handler and subscriber for multiprocess\n[`logbook`](http://logbook.readthedocs.io) logging that runs on the\n[`asyncio`](https://docs.python.org/3/library/asyncio.html) event loop. It uses\n[`aiopipe`](https://github.com/kchmck/aiopipe) to transfer log messages from the child\nprocess to the parent process.\n\n## Example\n\nThe following example shows a typical application of multiprocess logging. It results in\ntwo log messages, `hello from parent process` and `hello from child process`, being\nprinted in some order.\n\n```python\nfrom contextlib import closing\nfrom multiprocessing import Process\nimport asyncio\n\nfrom aiopipe import aiopipe\nfrom logbook_aiopipe import AioPipeSubscriber, \\\n AioPipeHandler\nfrom logbook import Logger, StderrHandler\n\nasync def mainTask(eventLoop):\n # The parent process logger can be set up as normal.\n log = Logger()\n log.handlers.append(StderrHandler())\n\n rx, tx = aiopipe()\n sub = AioPipeSubscriber(await rx.open(eventLoop), log)\n\n with closing(sub):\n subTask = eventLoop.create_task(sub.run())\n\n with tx.send() as tx:\n proc = Process(target=childProc, args=(tx,))\n proc.start()\n\n log.info(\"hello from parent process\")\n\n proc.join()\n await subTask\n\ndef childProc(tx):\n eventLoop = asyncio.new_event_loop()\n eventLoop.run_until_complete(childTask(eventLoop, tx))\n\nasync def childTask(eventLoop, tx):\n log = Logger()\n\n # The child process should use only `AioPipeHandler` as\n # its handler.\n handler = AioPipeHandler(await tx.open(eventLoop))\n log.handlers.append(handler)\n\n with closing(handler):\n log.info(\"hello from child process\")\n\neventLoop = asyncio.get_event_loop()\neventLoop.run_until_complete(mainTask(eventLoop))\n```\n\n## Installation\n\nThis package requires Python >= 3.5.0 and can be installed with `pip`:\n```\npip install logbook_aiopipe\n```\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/kchmck/logbook_aiopipe", "keywords": "logbook async asyncio pipe", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "logbook-aiopipe", "package_url": "https://pypi.org/project/logbook-aiopipe/", "platform": "", "project_url": "https://pypi.org/project/logbook-aiopipe/", "project_urls": { "Homepage": "https://github.com/kchmck/logbook_aiopipe" }, "release_url": "https://pypi.org/project/logbook-aiopipe/0.2.0/", "requires_dist": [ "logbook (~=1.4)", "pylint (==1.6.5); extra == 'dev'" ], "requires_python": "", "summary": "Multiprocess logbook logging for asyncio", "version": "0.2.0" }, "last_serial": 4126548, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "35079a19f78677698f59990b4451a53b", "sha256": "f05de3f27732a198d020fab2969243a4fe098b4b4c24ae7bcadb5efa18763992" }, "downloads": -1, "filename": "logbook_aiopipe-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "35079a19f78677698f59990b4451a53b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3960, "upload_time": "2017-07-27T17:10:15", "url": "https://files.pythonhosted.org/packages/c5/78/a505995e006cf941e895ba422da542ac68a55967eca5f3ae930c70863223/logbook_aiopipe-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecc3977b5ffedf224f50ec381e4ae330", "sha256": "fecabac79dd927390d9d94239e45e6292b960e409f1eb065ee2de2bee1e0e74b" }, "downloads": -1, "filename": "logbook_aiopipe-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ecc3977b5ffedf224f50ec381e4ae330", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2523, "upload_time": "2017-07-27T17:10:16", "url": "https://files.pythonhosted.org/packages/d5/e5/fc5e4dfdf4ba5420311c4bc0d569cb8b6cf86c528ddb70ec1dd5d9eea34f/logbook_aiopipe-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "34fd1ab048c9293cfa66031f3f6646f0", "sha256": "899e9e9619a748b3f5fa2abb64e47749cd5d4c2944b65688cd12118e5fe59520" }, "downloads": -1, "filename": "logbook_aiopipe-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "34fd1ab048c9293cfa66031f3f6646f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3821, "upload_time": "2018-08-01T22:36:38", "url": "https://files.pythonhosted.org/packages/54/10/6e37a88d467257c8f5fc413c6e70dbece7d7451e0af1c07f371295baabaf/logbook_aiopipe-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "389f26577643079d23a3dbd018add5b1", "sha256": "c21e421035eadbd572afb33042cd7cbfe9dfe865ce4b9c13d2e4c9375e7cae7f" }, "downloads": -1, "filename": "logbook_aiopipe-0.2.0.tar.gz", "has_sig": false, "md5_digest": "389f26577643079d23a3dbd018add5b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3001, "upload_time": "2018-08-01T22:36:39", "url": "https://files.pythonhosted.org/packages/bc/20/5d7cef1dc87db682dbbc6c680fead57697a1622dd611640c94fe01ca451c/logbook_aiopipe-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "34fd1ab048c9293cfa66031f3f6646f0", "sha256": "899e9e9619a748b3f5fa2abb64e47749cd5d4c2944b65688cd12118e5fe59520" }, "downloads": -1, "filename": "logbook_aiopipe-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "34fd1ab048c9293cfa66031f3f6646f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3821, "upload_time": "2018-08-01T22:36:38", "url": "https://files.pythonhosted.org/packages/54/10/6e37a88d467257c8f5fc413c6e70dbece7d7451e0af1c07f371295baabaf/logbook_aiopipe-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "389f26577643079d23a3dbd018add5b1", "sha256": "c21e421035eadbd572afb33042cd7cbfe9dfe865ce4b9c13d2e4c9375e7cae7f" }, "downloads": -1, "filename": "logbook_aiopipe-0.2.0.tar.gz", "has_sig": false, "md5_digest": "389f26577643079d23a3dbd018add5b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3001, "upload_time": "2018-08-01T22:36:39", "url": "https://files.pythonhosted.org/packages/bc/20/5d7cef1dc87db682dbbc6c680fead57697a1622dd611640c94fe01ca451c/logbook_aiopipe-0.2.0.tar.gz" } ] }