{ "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": "# redis_log_handler\nHandler for the standard `logging` module which puts logs through to Redis.\n\n## Install\nThis was developed against Python 3.6.7 specifically, but I don't believe it's version breaking.\n\n#### Development\nSet the local environment variable `REDIS_HOST` to point to the host where your Redis runs.\n\n $ export REDIS_HOST=localhost\n\nInstall the dev requirements\n\n $ pip install -r requirements-dev.txt\n\n## How to use\nYou can either publish your logs to a channel, `rpush` them onto a key with an optional `ttl`\nor implement the desired behaviour by deriving from the base class.\n\nTo add a handler to the python logger is very simple:\n\n```python\nimport logging\n\n\nfrom redis_log_handler import RedisKeyHandler\n\nexample_handler = RedisKeyHandler('example_key') # Default parameters for Redis 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 rpush this message to the 'example_key' in Redis.\")\n```\n\n### Configuring Redis Connection\nBy default each handler will create a `StrictRedis` instance, passing on each argument from their `__init__(**kwargs)` to the StrictRedis 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 te [python-redis documentation](https://redis-py.readthedocs.io/en/latest/).\n\n```python\nhandler = RedisKeyHandler(\"key\", host=\"localhost\", port=6379, password=None)\n\nconnection_pool = redis.ConnectionPool(host=\"localhost\")\nhandler = RedisKeyHandler(\"key\", connection_pool=connection_pool)\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\npure_handler = RedisKeyHandler(\"key_name\")\nraw_handler = RedisKeyHandler(\"other_key_name\", raw_logging=True)\n...\nlogging.info(\"Test message\")\n```\nThe `pure_handler` would emit a message like so: `Test message.`,\nthe `raw_handler` would emit a message like so: `Test message. - 2: /.../file.py`.\n\n### 1. RedisChannelHandler\nThis opens a connection to a redis channel, allowing subscribers to pickup new messages in realtime.\nEvery message triggered by the logging instance, will get published to the specified channel.\n\n```python\nhandler = RedisChannelHandler(\"channelname\")\n```\n\n### 2. RedisKeyHandler\nThis creates/pushes onto the provided key, whatever message the logging instance will emit.\nBy default every message will be sent via `rpush`, so that when the list is retrieved using `lrange $key 0 -1`, all messages are returned in the order they were sent.\nOptionally a `ttl` (time to live) can be provided which will be a counter that **will be set each time** a message is sent, essentially **refreshing the duration** of the time to live for this key.\n```python\nhandler = RedisKeyHandler(\"some_key_name\", ttl=60)\n```\n\n### 3. Custom Redis Handler\nWe also provide the ability to write custom emit functions, which get picked up by the logging instance, by inheriting the Base class.\nIf none of the provided Redis implementations rock you boat, simply inherit the Base class and overwrite the emit() method.\n\nIn the following example we will write an example of a CustomRedisHandler which overwrites the value of the key it already exists.\n```python\nclass CustomRedisHandler(RedisBaseHandler):\n def __init__(self, key: str, **kwargs: Any):\n super().__init__(**kwargs)\n self.key = key\n\n def emit(self, message: logging.LogRecord):\n self.redis_client.set(self.key, str(message))\n```\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/redis-log-handler", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "redis-log-handler", "package_url": "https://pypi.org/project/redis-log-handler/", "platform": "", "project_url": "https://pypi.org/project/redis-log-handler/", "project_urls": { "Homepage": "https://gitlab.adimian.com/open-source/redis-log-handler" }, "release_url": "https://pypi.org/project/redis-log-handler/0.0.1.dev32/", "requires_dist": [ "redis (==3.0.1)" ], "requires_python": "", "summary": "A log handler for the Python logging module, emitting all logs to specific Redis channels", "version": "0.0.1.dev32" }, "last_serial": 4953810, "releases": { "0.0.1.dev23": [ { "comment_text": "", "digests": { "md5": "e5946a34e782bc9d53cecd10e7823621", "sha256": "47fa458ada1c354558f7faa5fe0a598ebfb1a552b1f036fcef201e35c37914b4" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev23-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e5946a34e782bc9d53cecd10e7823621", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4002, "upload_time": "2019-01-22T15:18:13", "url": "https://files.pythonhosted.org/packages/1b/e4/615530643660429178655857ca751558189d5864a89b8ff31848230d57bd/redis_log_handler-0.0.1.dev23-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d96c3616d9c41dcd78f665116d3bea4f", "sha256": "c85d6d64f467549d4a8c3e736f83ee2d3f51fb3242902c3e95a6cd4afbb5de37" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev23.tar.gz", "has_sig": false, "md5_digest": "d96c3616d9c41dcd78f665116d3bea4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5331, "upload_time": "2019-01-22T15:18:14", "url": "https://files.pythonhosted.org/packages/c5/3e/0bd9f1b7a6356d2a46bbd6e070416e9d1c651dd9c24a9cf97368496e600f/redis-log-handler-0.0.1.dev23.tar.gz" } ], "0.0.1.dev24": [ { "comment_text": "", "digests": { "md5": "ebdd7f18858c1b8db4183fc327613a47", "sha256": "e15e69a19755e503a3f105516b942ce36f9cdf795d448ccaa895b3d7c34d7dae" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev24-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ebdd7f18858c1b8db4183fc327613a47", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4001, "upload_time": "2019-01-25T07:14:12", "url": "https://files.pythonhosted.org/packages/b0/37/4456eb8cb8214cac808460eed9d7da02123a792df85eb3eb7e5912e2d0da/redis_log_handler-0.0.1.dev24-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "172efa1b985988de75f428e3a05f54f9", "sha256": "3d5e48c306d46ad3db148b520038555a7f6356127a6cbd1d02bf79a45d495881" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev24.tar.gz", "has_sig": false, "md5_digest": "172efa1b985988de75f428e3a05f54f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5326, "upload_time": "2019-01-25T07:14:13", "url": "https://files.pythonhosted.org/packages/b6/5b/d4068edbb27324824e4e3280323908f1675892a2e6ec49c830323910cfb4/redis-log-handler-0.0.1.dev24.tar.gz" } ], "0.0.1.dev25": [ { "comment_text": "", "digests": { "md5": "b9da98f19290066f9e0cf1a088f8079b", "sha256": "8b2fae0497713b2414fa1bac4a6a89e8d3fefc887638dff85407caaf25ab58f7" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev25-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b9da98f19290066f9e0cf1a088f8079b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4155, "upload_time": "2019-03-15T12:23:11", "url": "https://files.pythonhosted.org/packages/ba/a6/eb026a836fced659da5aa3b14e62b29beea57b6d27037351600653d17e59/redis_log_handler-0.0.1.dev25-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2cd9829e692517269613423890291883", "sha256": "d5ec029495fc9211d3fec338e7082bc14453499540df255e7c63db3863649a05" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev25.tar.gz", "has_sig": false, "md5_digest": "2cd9829e692517269613423890291883", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6294, "upload_time": "2019-03-15T12:23:13", "url": "https://files.pythonhosted.org/packages/6e/bc/2d43900c7777982ff4560a1265aa0ab146a9a30378c3fbd90d44b3831d9d/redis-log-handler-0.0.1.dev25.tar.gz" } ], "0.0.1.dev30": [ { "comment_text": "", "digests": { "md5": "71eaaabc7e8fdf76972a5b013bca5ff3", "sha256": "1d5b9e83e1a7858577b312e4dbc5af61ee766f0f1aa3b93590438d246f59de5a" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev30-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "71eaaabc7e8fdf76972a5b013bca5ff3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4620, "upload_time": "2019-03-15T14:21:13", "url": "https://files.pythonhosted.org/packages/78/ee/5d96d391d9e03efca2b1da4b46031686a69d4a637bbb225aa6a6ddcecb29/redis_log_handler-0.0.1.dev30-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "652ec9590d25d0349918a6d35b3034b9", "sha256": "ab3505f441061a61721c12c8be657b85abc0a8713a1b7006c60a8cea679c413d" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev30.tar.gz", "has_sig": false, "md5_digest": "652ec9590d25d0349918a6d35b3034b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7186, "upload_time": "2019-03-15T14:21:14", "url": "https://files.pythonhosted.org/packages/b5/16/2a4ba475c7f943ccc95f80459578e6a7f42e9a3081fcd3821ce2b0e207c3/redis-log-handler-0.0.1.dev30.tar.gz" } ], "0.0.1.dev31": [ { "comment_text": "", "digests": { "md5": "af51842dba0c1d02a663711123179198", "sha256": "7a6f71a359150911a3aeca02e5482a3c06669edd39dc6b437160166b413f5c28" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev31-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "af51842dba0c1d02a663711123179198", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4621, "upload_time": "2019-03-15T14:40:16", "url": "https://files.pythonhosted.org/packages/91/58/3f271573f646b398dae8e1f0c6592fffccae5a9cfe508151deee8b66858f/redis_log_handler-0.0.1.dev31-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "82b272b17ffce35b5c77fbedc0a44dfd", "sha256": "573e035615e58de1bd59e2d5b1117cc14b335ac883591898e0c593b481db1b4a" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev31.tar.gz", "has_sig": false, "md5_digest": "82b272b17ffce35b5c77fbedc0a44dfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7219, "upload_time": "2019-03-15T14:40:18", "url": "https://files.pythonhosted.org/packages/14/d6/2dc943453e45a20c70292249831d6b535928389b7f030fe66f2b4939a377/redis-log-handler-0.0.1.dev31.tar.gz" } ], "0.0.1.dev32": [ { "comment_text": "", "digests": { "md5": "72241fe69147771719deded74bf8ad07", "sha256": "85f9df313d4fe66a82f316dbac542c43ccea205ee208084cc844ec927963cf8b" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev32-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "72241fe69147771719deded74bf8ad07", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5082, "upload_time": "2019-03-18T13:05:54", "url": "https://files.pythonhosted.org/packages/f5/ca/11f62521081158b196c495814c19ea08740104c7738b40ac5c6ee69a5009/redis_log_handler-0.0.1.dev32-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3cfe42055dbb6efee0a7e5071a1626c", "sha256": "6ad2bfa893ceeb33030bf026d3a738dbacd598c7be152bbc1a13b88d1e8fc445" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev32.tar.gz", "has_sig": false, "md5_digest": "d3cfe42055dbb6efee0a7e5071a1626c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7863, "upload_time": "2019-03-18T13:05:55", "url": "https://files.pythonhosted.org/packages/4e/70/28ce7bd7a02bf0e4396e82913c828dbec269348c9245de327ec30e370c95/redis-log-handler-0.0.1.dev32.tar.gz" } ], "0.0.1.dev7": [ { "comment_text": "", "digests": { "md5": "8c3b8a3580421544f49d7a53fe42dcef", "sha256": "ea77676c4d301694f606945bb6578144648b74d1847a62965d50c4a534e41e78" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev7.tar.gz", "has_sig": false, "md5_digest": "8c3b8a3580421544f49d7a53fe42dcef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3773, "upload_time": "2019-01-16T14:32:59", "url": "https://files.pythonhosted.org/packages/48/ca/ef44c3b8903e09b55fe16374013723974ca3114d931a45b8c53cd9174b80/redis-log-handler-0.0.1.dev7.tar.gz" } ], "0.0.1.dev9": [ { "comment_text": "", "digests": { "md5": "9c03e02d098f8bdf0f9fe062dfbf178e", "sha256": "d89faf32207867850541fbc566cc918efb4504f10c2e54cfb76c21fd36cfe3a0" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9c03e02d098f8bdf0f9fe062dfbf178e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3736, "upload_time": "2019-01-16T15:16:25", "url": "https://files.pythonhosted.org/packages/9c/67/bf314e796bd9b6f4903b9851063dccf0f142728eb12b5777ab97bbf2a292/redis_log_handler-0.0.1.dev9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d69cb2ccc038f20dc08146dcff0997b9", "sha256": "52c7e71edd22af8c2b23ef34a2df6087a0a036191ecbf9a576dd33916c3d0135" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev9.tar.gz", "has_sig": false, "md5_digest": "d69cb2ccc038f20dc08146dcff0997b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4111, "upload_time": "2019-01-16T15:16:26", "url": "https://files.pythonhosted.org/packages/10/67/e532795a9b2a67655e0fb82211d619d048e6fec08bed201077b2db7ced47/redis-log-handler-0.0.1.dev9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "72241fe69147771719deded74bf8ad07", "sha256": "85f9df313d4fe66a82f316dbac542c43ccea205ee208084cc844ec927963cf8b" }, "downloads": -1, "filename": "redis_log_handler-0.0.1.dev32-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "72241fe69147771719deded74bf8ad07", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5082, "upload_time": "2019-03-18T13:05:54", "url": "https://files.pythonhosted.org/packages/f5/ca/11f62521081158b196c495814c19ea08740104c7738b40ac5c6ee69a5009/redis_log_handler-0.0.1.dev32-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3cfe42055dbb6efee0a7e5071a1626c", "sha256": "6ad2bfa893ceeb33030bf026d3a738dbacd598c7be152bbc1a13b88d1e8fc445" }, "downloads": -1, "filename": "redis-log-handler-0.0.1.dev32.tar.gz", "has_sig": false, "md5_digest": "d3cfe42055dbb6efee0a7e5071a1626c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7863, "upload_time": "2019-03-18T13:05:55", "url": "https://files.pythonhosted.org/packages/4e/70/28ce7bd7a02bf0e4396e82913c828dbec269348c9245de327ec30e370c95/redis-log-handler-0.0.1.dev32.tar.gz" } ] }