{ "info": { "author": "See AUTHORS", "author_email": "contact@adimian.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Kafka Python Log Handler\nHandler for the standard `logging` module which puts logs through to Kafka.\nThe current implementation is very basic to accommodate our needs, but additional functionality may be coming when the parent project grows.\n\n## Install\nThis was developed in Python 3.6.7, using `kafka-python` 1.4.3 and Kafka 2.12\n\n#### Development\nTests will try to connect to a Kafka instance via the defaults.\nOptionally setting `KAFKA_HOST` and `KAFKA_PORT` to the appropriate location on your machine will change this.\n\nInstall the dev requirements\n\n $ pip install -r requirements-dev.txt\n\nSet the pre-commit hook\n\n $ pre-commit install\n\n## How to use\nThe only necessary thing to create this handler is a `topic` to push the values to.\nOptionally, a `key` and/or `partition` may be provided.\nAny additional keyword-value configuration provided to the Handler will be used to initialize the `kafka.KafkaProducer`.\n\nTo add a handler to the python logger is very simple:\n\n```python\nimport logging\n\n\nfrom kafka_handler import KafkaLogHandler\n\nhandler = KafkaLogHandler(topic=\"example_topic\", key=\"example_key\") # Default parameters for Kafka connection are used\n\nlogger = logging.getLogger() # No name gives you the root logger\nlogger.setLevel(\"WARNING\")\nlogger.addHandler(example_handler)\n\nlogger.warning(\"This will push this message to the 'example_topic' in Kafka.\")\n```\n\n### Configuring Kafka Connection\nBy default each handler will create a `kafka.KafkaProducer` instance, passing on each argument from their `__init__(**kwargs)` to the KafkaProducer's instantiation.\nThis means you can configure the connection as specific as you'd like, but every argument should be provided with its keyword; `Handler(host=\"localhost\")` instead of `Handler(\"localhost\")`.\nAll available configuration options are available in the [kafka-python documentation](https://kafka-python.readthedocs.io/en/master/apidoc/KafkaProducer.html).\n\n```python\nhandler = KafkaLogHandler(topic=\"topic\", bootstrap_servers=\"other_host:9092\", retries=0)\n```\n\n### Configure message logging\nEvery handler has the `raw_logging` option which can be provided optionally.\nOmitting it from the initialisation, will default it to `False`, meaning the message being logged will be purely what's sent.\nIf you set it to `True`, first the content will be logged, then appended to the line number and finally the pathname.\n\n```python\nraw_handler = KafkaLogHandler(topic=\"topic\", raw_logging=True)\n...\nlogging.info(\"Test message\")\n```\nA pure handler would emit a message like so: `Test message.`, \nthe `raw_handler` however, will emit a message like so: `Test message. - 2: /.../file.py`.\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://gitlab.adimian.com/open-source/kafka-log-handler", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "kafka-python-log-handler", "package_url": "https://pypi.org/project/kafka-python-log-handler/", "platform": "", "project_url": "https://pypi.org/project/kafka-python-log-handler/", "project_urls": { "Homepage": "https://gitlab.adimian.com/open-source/kafka-log-handler" }, "release_url": "https://pypi.org/project/kafka-python-log-handler/0.0.1.dev12/", "requires_dist": [ "kafka-python (==1.4.3)" ], "requires_python": "", "summary": "A log handler for the Python logging module, emitting logs to Kafka topics.", "version": "0.0.1.dev12" }, "last_serial": 5233245, "releases": { "0.0.1.dev11": [ { "comment_text": "", "digests": { "md5": "06ca9b73eddef7a1cf556e7bb32bdb34", "sha256": "dbfbeb8ab2337e47bdda40c4fd5826f7fb7f3b7ac4b4752301edad834dc358b0" }, "downloads": -1, "filename": "kafka_python_log_handler-0.0.1.dev11-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "06ca9b73eddef7a1cf556e7bb32bdb34", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4724, "upload_time": "2019-04-19T08:33:16", "url": "https://files.pythonhosted.org/packages/7e/b5/6f625db8177c86fbbae436642e14cad2dba5fff4846d7cec4b70c70f6c27/kafka_python_log_handler-0.0.1.dev11-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13d09f0dabd00479925889bb60965267", "sha256": "5b552e878082ae5b5efeb8cf1894ba1dd41c3ac15ddf41114eb712af43b60a01" }, "downloads": -1, "filename": "kafka-python-log-handler-0.0.1.dev11.tar.gz", "has_sig": false, "md5_digest": "13d09f0dabd00479925889bb60965267", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6506, "upload_time": "2019-04-19T08:33:18", "url": "https://files.pythonhosted.org/packages/ea/c1/43cb4e7b07ee835ededb3eb3da743f999ded973da39008e5ecd6f6cfe157/kafka-python-log-handler-0.0.1.dev11.tar.gz" } ], "0.0.1.dev12": [ { "comment_text": "", "digests": { "md5": "61e9be0572b934887b018f90e1dde5d6", "sha256": "b9379b7ae47ba72ac4f46ff6a5d14266a4a8fa5c0ff244223e479996948ed9aa" }, "downloads": -1, "filename": "kafka_python_log_handler-0.0.1.dev12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "61e9be0572b934887b018f90e1dde5d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4727, "upload_time": "2019-05-06T14:16:13", "url": "https://files.pythonhosted.org/packages/a7/ba/96c58e14b9695e2e6e82ca926008085fb27a8dfc184267e855cb1c59453f/kafka_python_log_handler-0.0.1.dev12-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "96b1e988696d21e9b6f1262ebcfa0b41", "sha256": "0b748dffcea2a4ce4d1aaba1dded602925ade0a7168d3a096e67ffee7a9589a0" }, "downloads": -1, "filename": "kafka-python-log-handler-0.0.1.dev12.tar.gz", "has_sig": false, "md5_digest": "96b1e988696d21e9b6f1262ebcfa0b41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6520, "upload_time": "2019-05-06T14:16:15", "url": "https://files.pythonhosted.org/packages/4c/56/4c94f82255b834b2f4ee9eadd90c1c3d87f48c1505a11608849288c5699c/kafka-python-log-handler-0.0.1.dev12.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "61e9be0572b934887b018f90e1dde5d6", "sha256": "b9379b7ae47ba72ac4f46ff6a5d14266a4a8fa5c0ff244223e479996948ed9aa" }, "downloads": -1, "filename": "kafka_python_log_handler-0.0.1.dev12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "61e9be0572b934887b018f90e1dde5d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4727, "upload_time": "2019-05-06T14:16:13", "url": "https://files.pythonhosted.org/packages/a7/ba/96c58e14b9695e2e6e82ca926008085fb27a8dfc184267e855cb1c59453f/kafka_python_log_handler-0.0.1.dev12-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "96b1e988696d21e9b6f1262ebcfa0b41", "sha256": "0b748dffcea2a4ce4d1aaba1dded602925ade0a7168d3a096e67ffee7a9589a0" }, "downloads": -1, "filename": "kafka-python-log-handler-0.0.1.dev12.tar.gz", "has_sig": false, "md5_digest": "96b1e988696d21e9b6f1262ebcfa0b41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6520, "upload_time": "2019-05-06T14:16:15", "url": "https://files.pythonhosted.org/packages/4c/56/4c94f82255b834b2f4ee9eadd90c1c3d87f48c1505a11608849288c5699c/kafka-python-log-handler-0.0.1.dev12.tar.gz" } ] }