This module implements a python `logging` formatter which produces well-formed RFC5424-compatible Syslog messages to a given socket.
[![CI](https://github.com/EasyPost/syslog-rfc5424-formatter/workflows/CI/badge.svg)](https://github.com/EasyPost/syslog-rfc5424-formatter/actions?query=workflow%3ACI)
[![PyPI version](https://badge.fury.io/py/syslog-rfc5424-formatter.svg)](https://badge.fury.io/py/syslog-rfc5424-formatter)
[![Documentation Status](https://readthedocs.org/projects/syslog-rfc5424-formatter/badge/?version=latest)](https://syslog-rfc5424-formatter.readthedocs.io/en/latest/?badge=latest)
## Usage
If you're configuring your loggers from code, you should use this formatter as below:
```python
import logging
import logging.handlers
from syslog_rfc5424_formatter import RFC5424Formatter
def set_up_logging():
h = logging.handlers.SysLogHandler('/path/to/syslog_socket')
h.setFormatter(RFC5424Formatter())
logging.getLogger('').addHandler(h)
```
If you're using a more modern combination of a JSON/YAML config file and `logging.config.dictConfig`, your config file should look like the following (assuming YAML concrete syntax):
```yaml
formatters:
syslog:
(): syslog_rfc5424_formatter.RFC5424Formatter
handlers:
syslog:
formatter: syslog
class: logging.handlers.SysLogHandler
address: "/path/to/syslog/socket"
facility: "ext://logging.handlers.SysLogHandler.LOG_USER"
root:
level: INFO
handlers:
- syslog
```
## License
This work is licensed under the ISC license, the text of which can be found at [LICENSE.txt](LICENSE.txt).
Raw data
{
"_id": null,
"home_page": "https://github.com/easypost/syslog-rfc5424-formatter",
"name": "syslog-rfc5424-formatter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
"maintainer_email": "",
"keywords": "logging",
"author": "EasyPost",
"author_email": "oss@easypost.com",
"download_url": "https://files.pythonhosted.org/packages/b1/51/882bc5987d3924fa0c259459195b0ff478fc97cdf9a375f6d5219d1525e3/syslog-rfc5424-formatter-1.2.3.tar.gz",
"platform": null,
"description": "This module implements a python `logging` formatter which produces well-formed RFC5424-compatible Syslog messages to a given socket.\n\n[![CI](https://github.com/EasyPost/syslog-rfc5424-formatter/workflows/CI/badge.svg)](https://github.com/EasyPost/syslog-rfc5424-formatter/actions?query=workflow%3ACI)\n[![PyPI version](https://badge.fury.io/py/syslog-rfc5424-formatter.svg)](https://badge.fury.io/py/syslog-rfc5424-formatter)\n[![Documentation Status](https://readthedocs.org/projects/syslog-rfc5424-formatter/badge/?version=latest)](https://syslog-rfc5424-formatter.readthedocs.io/en/latest/?badge=latest)\n\n\n## Usage\n\nIf you're configuring your loggers from code, you should use this formatter as below:\n\n```python\nimport logging\nimport logging.handlers\nfrom syslog_rfc5424_formatter import RFC5424Formatter\n\n\ndef set_up_logging():\n h = logging.handlers.SysLogHandler('/path/to/syslog_socket')\n h.setFormatter(RFC5424Formatter())\n logging.getLogger('').addHandler(h)\n```\n\n\nIf you're using a more modern combination of a JSON/YAML config file and `logging.config.dictConfig`, your config file should look like the following (assuming YAML concrete syntax):\n\n```yaml\nformatters:\n syslog:\n (): syslog_rfc5424_formatter.RFC5424Formatter\n\nhandlers:\n syslog:\n formatter: syslog\n class: logging.handlers.SysLogHandler\n address: \"/path/to/syslog/socket\"\n facility: \"ext://logging.handlers.SysLogHandler.LOG_USER\"\n\nroot:\n level: INFO\n handlers:\n - syslog\n```\n\n## License\n\nThis work is licensed under the ISC license, the text of which can be found at [LICENSE.txt](LICENSE.txt).\n\n\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "Logging formatter which produces well-formatted RFC5424 Syslog Protocol messages",
"version": "1.2.3",
"split_keywords": [
"logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "4ff287709bbc3f3f3966fd81ba415ea7",
"sha256": "958b9896097fea58e271b95f70aa71d5330882a888f685f2ca8aac872be5efa3"
},
"downloads": -1,
"filename": "syslog_rfc5424_formatter-1.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4ff287709bbc3f3f3966fd81ba415ea7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
"size": 5024,
"upload_time": "2022-04-15T20:54:01",
"upload_time_iso_8601": "2022-04-15T20:54:01.333890Z",
"url": "https://files.pythonhosted.org/packages/29/94/83e7fd5a49165cb98ac01c57748c2f9a7ba8aeee1a154aa6843a2bed74a2/syslog_rfc5424_formatter-1.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "d79e4ede143409c22b66575ada5f4948",
"sha256": "9bc5c9c3fb6a92b6f85ca108f2be04ea50106113324b5d7b1f07fcc6ad2766d3"
},
"downloads": -1,
"filename": "syslog-rfc5424-formatter-1.2.3.tar.gz",
"has_sig": false,
"md5_digest": "d79e4ede143409c22b66575ada5f4948",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
"size": 5243,
"upload_time": "2022-04-15T20:54:02",
"upload_time_iso_8601": "2022-04-15T20:54:02.724087Z",
"url": "https://files.pythonhosted.org/packages/b1/51/882bc5987d3924fa0c259459195b0ff478fc97cdf9a375f6d5219d1525e3/syslog-rfc5424-formatter-1.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-04-15 20:54:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "easypost",
"github_project": "syslog-rfc5424-formatter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "syslog-rfc5424-formatter"
}