{ "info": { "author": "unpluggedcoder", "author_email": "unpluggedcoder@outlook.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Logging" ], "description": "## asynclog\n[![Build Status](https://travis-ci.org/unpluggedcoder/asynclog.svg?branch=master)](https://travis-ci.org/unpluggedcoder/asynclog) [![Coverage Status](https://coveralls.io/repos/github/unpluggedcoder/asynclog/badge.svg?branch=master)](https://coveralls.io/github/unpluggedcoder/asynclog?branch=master)\n\n`asynclog` provide the asynchronous way for python logging. Leave the logging I/O(especially the network I/O when we want to logging to a network endpoint) to the asynchronous thread or asynchronous task provided by [celery](http://www.celeryproject.org/) .\n\n#### Requirements\n\n* Python 3.5+\n\n#### Install\n\n```shell\npip install asynclog\n```\n\n#### Usage\n\n* Config from dict\n\n```python\nlog_cfg = {\n 'version': 1,\n 'disable_existing_loggers': False,\n 'formatters': {\n 'simple': {\n 'format': '%(asctime)s \\n %(levelname)s \\n %(message)s'\n },\n },\n 'handlers': {\n 'async_handler': {\n 'level': 'INFO',\n 'formatter': 'simple',\n 'class': 'asynclog.AsyncLogDispatcher',\n 'func': '[Dot_Path_To_Your_Func]',\n }\n },\n 'loggers': {\n 'asynclogger': {\n 'handlers': ['async_handler', ],\n 'level': 'DEBUG',\n 'propagate': False,\n },\n }\n}\n\nlogging.config.dictConfig(log_cfg)\nlogger = logging.getLogger('asynclogger')\nlogger.info('Test asynclog')\n```\n\n* Using thread\n\n```python\nimport logging\nimport time\n\nfrom asynclog import AsyncLogDispatcher\n\n\ndef write_log(msg):\n # Do write stuff, such as write log msg into network.\n # ...\n time.sleep(0.5)\n\n\nlogger = logging.getLogger()\nlogger.setLevel(logging.INFO)\nhandler = AsyncLogDispatcher(write_log)\nhandler.setLevel(logging.INFO)\nlogger.addHandler(handler)\n\nlogger.info('Test Log')\n```\n\n* Using Celery\n\n```python\nfrom celery import shared_task\n\n@shared_task\ndef write_task(msg):\n # Write log in Network IO\n print(msg)\n \ncelery_handler = AsyncLogDispatcher(write_task, use_thread=False, use_celery=True)\ncelery_handler.setLevel(logging.INFO)\nlogger.addHandler(celery_handler)\n\nlogger.info('Test Log')\n```\n\n#### Test\n\n```shell\npython3 -m unittest\n......\n----------------------------------------------------------------------\nRan 6 tests in 0.007s\n\nOK\n```\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/unpluggedcoder/asynclog", "keywords": "logging asynchronous", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "asynclog", "package_url": "https://pypi.org/project/asynclog/", "platform": "", "project_url": "https://pypi.org/project/asynclog/", "project_urls": { "Homepage": "https://github.com/unpluggedcoder/asynclog" }, "release_url": "https://pypi.org/project/asynclog/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "Asynchronous log for python logging.", "version": "0.1.7" }, "last_serial": 4030178, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "78c8c1671ca8dc0653860121383e97e1", "sha256": "0b7153639066040365e15de7799a6fefb371e69ac6ceaea9b3b420596173576f" }, "downloads": -1, "filename": "asynclog-0.1.2.tar.gz", "has_sig": false, "md5_digest": "78c8c1671ca8dc0653860121383e97e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2591, "upload_time": "2018-04-17T10:13:40", "url": "https://files.pythonhosted.org/packages/7a/04/a4ce7dd463b899e3e9bc87e89cc72578e66857c5e5317b310733b1900f3d/asynclog-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "df05b923524324be5a9efb80b288cb67", "sha256": "f2562fd8b3abe2bcaaca4ab1e91279a6e1c21f38b5f7b249775b4f9102628536" }, "downloads": -1, "filename": "asynclog-0.1.3.tar.gz", "has_sig": false, "md5_digest": "df05b923524324be5a9efb80b288cb67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3117, "upload_time": "2018-04-17T10:13:42", "url": "https://files.pythonhosted.org/packages/c9/8b/821442f55702a2620433203c41607bf01ce4920115b27fa66bc689afde15/asynclog-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "47772467a7420cd75ae99f22a8f01647", "sha256": "4749dd541c452a7b7b023d205172b879cbb3f4098619d9f95720067cae08a9c6" }, "downloads": -1, "filename": "asynclog-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "47772467a7420cd75ae99f22a8f01647", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5164, "upload_time": "2018-04-17T10:13:39", "url": "https://files.pythonhosted.org/packages/d7/ba/011f069becd3c8852ebe4809d742e768bf171eb6e6fe22f704547f0b680a/asynclog-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b1fc44fe99d00dd36c7692ef3425b9b4", "sha256": "b68df6f2205be12e94942ec4886c8ff776d5283450f24255aa639831ba579e8b" }, "downloads": -1, "filename": "asynclog-0.1.4.tar.gz", "has_sig": false, "md5_digest": "b1fc44fe99d00dd36c7692ef3425b9b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4482, "upload_time": "2018-04-17T10:13:43", "url": "https://files.pythonhosted.org/packages/e8/8a/8153d9faae28a3c1b9bb4dbc181423997642c92779d061b42766b4003795/asynclog-0.1.4.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "fa28daf987399b462153252555282c11", "sha256": "f38ea7d4787132790e4e909796e6c3b170d2752f4e5f82c2b4e19eb897b139ad" }, "downloads": -1, "filename": "asynclog-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "fa28daf987399b462153252555282c11", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5976, "upload_time": "2018-04-22T10:04:37", "url": "https://files.pythonhosted.org/packages/bb/86/441813613b9c5f53d16c2ee2bfd727f0e8f4977e711b06fd1b1473f582fe/asynclog-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ed2c35e920f4b0ab2ed0dd385e32a064", "sha256": "d28b55b1dfb983caf4069c0eed12b2e0af3ed4fd29331ad61896d04f758eae6a" }, "downloads": -1, "filename": "asynclog-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ed2c35e920f4b0ab2ed0dd385e32a064", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5146, "upload_time": "2018-04-22T10:04:41", "url": "https://files.pythonhosted.org/packages/71/ba/08d0d8f380f568b2db7bf543c44974e180f1bf01071a071a1b3834ceb1ce/asynclog-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "4a4900eeb2fee853490b8eba97864e17", "sha256": "532c426f07d85cd13e467ff55601f76903fe646e66471f1cf37ccea5c865c7be" }, "downloads": -1, "filename": "asynclog-0.1.7.tar.gz", "has_sig": false, "md5_digest": "4a4900eeb2fee853490b8eba97864e17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5130, "upload_time": "2018-07-04T13:49:31", "url": "https://files.pythonhosted.org/packages/35/d9/80f722ed8ee9d30c84b31811e0589ee012aee2ea6561afba50fabd770fcc/asynclog-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4a4900eeb2fee853490b8eba97864e17", "sha256": "532c426f07d85cd13e467ff55601f76903fe646e66471f1cf37ccea5c865c7be" }, "downloads": -1, "filename": "asynclog-0.1.7.tar.gz", "has_sig": false, "md5_digest": "4a4900eeb2fee853490b8eba97864e17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5130, "upload_time": "2018-07-04T13:49:31", "url": "https://files.pythonhosted.org/packages/35/d9/80f722ed8ee9d30c84b31811e0589ee012aee2ea6561afba50fabd770fcc/asynclog-0.1.7.tar.gz" } ] }