# logdriver
Run a socket server for application logging.
Implemented as a CLI. Receives pickled LogRecord objects over a socket,
buffers them, and handles them according to application requirements.
## Installation
```shell
pip install logdriver
```
## Example
Start `logdriver` on the command-line using default options. This will start the socket
server listening on `localhost` on port `9079`. It will use a `StreamLogger` to log
all the LogRecords it receives to `stdout`, and set the logging level to `WARNING`.
```shell
$ logdriver
Started logdriver logging socket server
Listening for logs on localhost:9079
Press CTRL+C to quit
Starting TCP server
```
In your Python application, configure your logger to use a `SocketHandler`:
```python
import logging
from logging.handlers import SocketHandler
handler = SocketHandler("localhost", 9079)
logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.warning("Hello, world!")
```
You should see the log getting printed by the socket server.
Raw data
{
"_id": null,
"home_page": "",
"name": "logdriver",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "logging,logger,microservice,cli",
"author": "Steve King",
"author_email": "steve@steveking.site",
"download_url": "https://files.pythonhosted.org/packages/d9/58/35ce6e460f2f3a1f9e7a3d6fb1b0be149be4693964f9ec25f899b483f371/logdriver-0.1.5.tar.gz",
"platform": null,
"description": "# logdriver\n\nRun a socket server for application logging.\nImplemented as a CLI. Receives pickled LogRecord objects over a socket, \nbuffers them, and handles them according to application requirements.\n\n## Installation\n\n```shell\npip install logdriver\n```\n\n## Example\n\nStart `logdriver` on the command-line using default options. This will start the socket\nserver listening on `localhost` on port `9079`. It will use a `StreamLogger` to log\nall the LogRecords it receives to `stdout`, and set the logging level to `WARNING`.\n\n```shell\n$ logdriver\nStarted logdriver logging socket server\nListening for logs on localhost:9079\nPress CTRL+C to quit\nStarting TCP server\n```\n\nIn your Python application, configure your logger to use a `SocketHandler`:\n\n```python\nimport logging\nfrom logging.handlers import SocketHandler\nhandler = SocketHandler(\"localhost\", 9079)\nlogger = logging.getLogger(__name__)\nlogger.addHandler(handler)\n\nlogger.warning(\"Hello, world!\")\n```\n\nYou should see the log getting printed by the socket server.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Run a socket server for application logging",
"version": "0.1.5",
"project_urls": {
"documentation": "https://github.com/sjking/logdriver",
"homepage": "https://github.com/sjking/logdriver",
"repository": "https://github.com/sjking/logdriver"
},
"split_keywords": [
"logging",
"logger",
"microservice",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "16f2a7092bfb281dbb56c37938043f356bc51d27327b4db80d231b23791e612f",
"md5": "a8fc2981748684e5f5b1fd01bbf91e15",
"sha256": "d0933c952c187746f15b099005cab255d95df4ea0594fa5039329dff1fcddae3"
},
"downloads": -1,
"filename": "logdriver-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a8fc2981748684e5f5b1fd01bbf91e15",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 12722,
"upload_time": "2023-10-12T21:43:11",
"upload_time_iso_8601": "2023-10-12T21:43:11.282427Z",
"url": "https://files.pythonhosted.org/packages/16/f2/a7092bfb281dbb56c37938043f356bc51d27327b4db80d231b23791e612f/logdriver-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d95835ce6e460f2f3a1f9e7a3d6fb1b0be149be4693964f9ec25f899b483f371",
"md5": "882d83a22f3f17bb313d0501b9d157cf",
"sha256": "77fca66598ba93eb81fad0b3fb3faaee838de230285d0725fb98ab8c6e80b568"
},
"downloads": -1,
"filename": "logdriver-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "882d83a22f3f17bb313d0501b9d157cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7686,
"upload_time": "2023-10-12T21:43:14",
"upload_time_iso_8601": "2023-10-12T21:43:14.975615Z",
"url": "https://files.pythonhosted.org/packages/d9/58/35ce6e460f2f3a1f9e7a3d6fb1b0be149be4693964f9ec25f899b483f371/logdriver-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-12 21:43:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sjking",
"github_project": "logdriver",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "logdriver"
}