Name | casavo-log-formatter JSON |
Version |
1.0.3
JSON |
| download |
home_page | |
Summary | A pre-configured JSON formatter for the Casavo logging format |
upload_time | 2023-07-31 09:48:26 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.9 |
license | Copyright 2023 Casavo Management S.p.A. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
casavo
logging
json
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# casavo-log-formatter
An utility library that exposes a pre-configured log formatter for the Casavo JSON logging format.
## Installation
`pip install casavo-log-formatter`, or `pip install casavo-log-formatter[orjson]` if you prefer using `orjson` as a json serializer.
## Usage
Referring to https://docs.python.org/3/library/logging.config.html#logging-config-dictschema,
we suggest to configure your logging `dictConfig` by adding those 2 keys:
```python
formatters = {
"simple": {
"format": "%(levelname)s %(message)s",
"datefmt": "%H:%M:%S",
},
"standard": {
"class": "casavo_log_formatter.formatters.CasavoJsonFormatter"
},
}
```
```python
handlers = {
"stdout": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "standard"
if settings.ENVIRONMENT in ["staging", "production"] # or whatever you use to specify the env
else "simple",
},
}
```
This will configure a simple log format for dev and the fully featured formatter for staging + dev.
## Development
* Have a local python >=3.9
* `python -m venv .venv`
* `pip install -r requirements.txt`
* `pre-commit install`
* `pip install -e .`
### Test
`make test` or `nox` to launch the test matrix against Python 3.9, 3.10, 3.11
### Uploading on PyPI
* `make upload`
Raw data
{
"_id": null,
"home_page": "",
"name": "casavo-log-formatter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Casavo <tech.internals@casavo.com>",
"keywords": "casavo,logging,json",
"author": "",
"author_email": "Casavo <tech.internals@casavo.com>",
"download_url": "https://files.pythonhosted.org/packages/59/8e/3ee2aeeaf030cc1b296bc1460491a6f2507a126e0eeb9b1fcedef213f807/casavo-log-formatter-1.0.3.tar.gz",
"platform": null,
"description": "# casavo-log-formatter\n\nAn utility library that exposes a pre-configured log formatter for the Casavo JSON logging format.\n\n## Installation\n\n`pip install casavo-log-formatter`, or `pip install casavo-log-formatter[orjson]` if you prefer using `orjson` as a json serializer.\n\n## Usage\n\nReferring to https://docs.python.org/3/library/logging.config.html#logging-config-dictschema,\nwe suggest to configure your logging `dictConfig` by adding those 2 keys:\n\n```python\nformatters = {\n \"simple\": {\n \"format\": \"%(levelname)s %(message)s\",\n \"datefmt\": \"%H:%M:%S\",\n },\n \"standard\": {\n \"class\": \"casavo_log_formatter.formatters.CasavoJsonFormatter\"\n },\n}\n```\n\n```python\nhandlers = {\n \"stdout\": {\n \"level\": \"DEBUG\",\n \"class\": \"logging.StreamHandler\",\n \"formatter\": \"standard\"\n if settings.ENVIRONMENT in [\"staging\", \"production\"] # or whatever you use to specify the env\n else \"simple\",\n },\n}\n```\n\nThis will configure a simple log format for dev and the fully featured formatter for staging + dev.\n\n## Development\n\n* Have a local python >=3.9\n* `python -m venv .venv`\n* `pip install -r requirements.txt`\n* `pre-commit install`\n* `pip install -e .`\n\n### Test\n\n`make test` or `nox` to launch the test matrix against Python 3.9, 3.10, 3.11\n\n### Uploading on PyPI\n\n* `make upload`\n",
"bugtrack_url": null,
"license": "Copyright 2023 Casavo Management S.p.A. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A pre-configured JSON formatter for the Casavo logging format",
"version": "1.0.3",
"project_urls": {
"Bug Reports": "https://github.com/casavo/casavo-log-formatter/issues",
"Homepage": "https://github.com/casavo/casavo-log-formatter",
"Source": "https://github.com/casavo/casavo-log-formatter"
},
"split_keywords": [
"casavo",
"logging",
"json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "34c2a7b8b6f2da3d45886d31f91759f351575b2961565098d26f0884c7066c4c",
"md5": "cbac71368ce13efd51bd8272ad96f6b4",
"sha256": "957ef1da5b7a6010e23852efe3f97e06a35242717f1c434c62014dae0a7c6988"
},
"downloads": -1,
"filename": "casavo_log_formatter-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cbac71368ce13efd51bd8272ad96f6b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4863,
"upload_time": "2023-07-31T09:48:25",
"upload_time_iso_8601": "2023-07-31T09:48:25.065612Z",
"url": "https://files.pythonhosted.org/packages/34/c2/a7b8b6f2da3d45886d31f91759f351575b2961565098d26f0884c7066c4c/casavo_log_formatter-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "598e3ee2aeeaf030cc1b296bc1460491a6f2507a126e0eeb9b1fcedef213f807",
"md5": "b5e29d10b9fe3f0cee70d2bd633760bc",
"sha256": "a45566eeb7f1be959bbc0f71068c969b70fbf1d2864166795a91b33fc5fe8e08"
},
"downloads": -1,
"filename": "casavo-log-formatter-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "b5e29d10b9fe3f0cee70d2bd633760bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5602,
"upload_time": "2023-07-31T09:48:26",
"upload_time_iso_8601": "2023-07-31T09:48:26.967876Z",
"url": "https://files.pythonhosted.org/packages/59/8e/3ee2aeeaf030cc1b296bc1460491a6f2507a126e0eeb9b1fcedef213f807/casavo-log-formatter-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-31 09:48:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "casavo",
"github_project": "casavo-log-formatter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "casavo-log-formatter"
}