graylog-json-formatter
JSON log formatter for Graylog — a logging.Formatter that emits structured JSON,
passing record extra fields through and mapping Python log levels to Graylog severities.
Installation
pip install entirius-py-graylog-json-formatter
Usage
import logging
import graylog_json_formatter
json_handler = logging.FileHandler(filename="app.json.log")
json_handler.setFormatter(graylog_json_formatter.GraylogJSONFormatter())
logger = logging.getLogger("my_json")
logger.addHandler(json_handler)
logger.info("Order created", extra={"order_id": "18"})
In Django settings.py:
from graylog_json_formatter import GraylogJSONFormatter
LOGGING["formatters"]["graylog_json"] = {"()": GraylogJSONFormatter}
LOGGING["handlers"]["handler_name"] = {
"level": "DEBUG",
"class": "logging.FileHandler",
"filename": os.path.join(LOG_DIR, "app.json.log"),
"encoding": "utf8",
"formatter": "graylog_json",
}
Development
make install # sync dependencies (uv)
make check # lint + format check (ruff)
make test # test suite (pytest)
Development and agent instructions: AGENTS.md.
License
Mozilla Public License 2.0 — see LICENSE.
Metadata
Release files for entirius-py-graylog-json-formatter 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entirius_py_graylog_json_formatter-2.0.0.tar.gz | 23.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entirius_py_graylog_json_formatter-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.8 kB
Release files / entirius_py_graylog_json_formatter-2.0.0.tar.gz
| Download URL | entirius_py_graylog_json_formatter-2.0.0.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1d6ddef6a5774a43d36bcfa925abf459debd1edb1dc5f4c5c9b60400c275d0e
|
|
BLAKE2b-256 checksum How to use checksums |
2ec562d89e0da15f44a944e06dfdc520821ebf143f44d949feb234824266cff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / entirius_py_graylog_json_formatter-2.0.0-py3-none-any.whl
| Download URL | entirius_py_graylog_json_formatter-2.0.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9559af5aad3cd6ada8a8f63205f1a8a20bff51b6534b51530d9d6df3890edbe
|
|
BLAKE2b-256 checksum How to use checksums |
9515811f49a77af6d89b4d04b0f44c98bff78fd9483946c52456776fa77e15f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|