`Repository <https://bitbucket.org/bear_belly/json_log_formatter>`__
Formats log output in JSON format. Shows all fields of a log record.
Here is an example of the output.
::
...
{
"name": "somemodule.util",
"msg": "This is a log message",
"args": "()",
"levelname": "DEBUG",
"levelno": "10",
"pathname": "/path/to/pyfile.py",
"filename": "util.py",
"module": "util",
"exc_info": "None",
"exc_text": "None",
"stack_info": "None",
"lineno": "217",
"funcName": "do_something",
"created": "1520373828.7142632",
"msecs": "714.2632007598877",
"relativeCreated": "2531.79669380188",
"thread": "140244615616320",
"threadName": "MainThread",
"processName": "MainProcess",
"process": "11519"
}
{
"name": "somemodule.util",
"msg": "This is an error message",
"args": "()",
"levelname": "ERROR",
"levelno": "10",
"pathname": "/path/to/otherfile.py",
"filename": "util.py",
"module": "util",
"exc_info": "None",
"exc_text": "None",
"stack_info": "None",
"lineno": "217",
"funcName": "do_something",
"created": "1520373218.7142632",
"msecs": "810.2632007598877",
"relativeCreated": "8531.79669380188",
"thread": "140244615616320",
"threadName": "MainThread",
"processName": "MainProcess",
"process": "11519"
}
...
Installation
------------
Install as you would any other python package::
::
$ pip install json-log-formatter
Usage
-----
To use the formatter, include it in logging config as you would other
formatters.
The formatter takes one optional argument ``json_kwargs``. These are
keywords that are passed directly to
```json.dumps()`` <https://docs.python.org/3/library/json.html#json.dumps>`__.
YAML Example
~~~~~~~~~~~~
::
logging:
version: 1
formatters:
...
json:
class: json_log_formatter.JsonFormatter
json_kwargs:
indent: 2
...
handlers:
....
json_console:
class: logging.StreamHandler
formatter: json
...
loggers:
...
console:
level: DEBUG
handler: json_console
...
root:
...
level: DEBUG
handlers: [json_console, ]
...
Dict example
~~~~~~~~~~~~
::
'logging': {
'version': 1,
'formatters': {
...
'json': {
'class': 'json_log_formatter.JsonFormatter',
'json_kwargs': {
indent: 2
...
},
...
},
...
},
'handlers': {
....
'json_console': {
'class': 'logging.StreamHandler',
'formatter': 'json',
},
...
},
'loggers': {
...
'console': {
'level': 'DEBUG',
'handler': 'json_console',
},
...
},
'root': {
...
'level': 'DEBUG',
'handlers': ['json_console', ]
...
},
...
}
Home-page: UNKNOWN
Author: Jordan Hewitt
Author-email: jordan.h@startmail.com
License: GPLv3
Description: UNKNOWN
Keywords: json log output format flannel
Platform: UNKNOWN
Metadata
Release files for python3-json-log-formatter 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python3_json_log_formatter-1.6.1.linux-x86_64.tar.gz | 7.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python3_json_log_formatter-1.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / python3_json_log_formatter-1.6.1.linux-x86_64.tar.gz
| Download URL | python3_json_log_formatter-1.6.1.linux-x86_64.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15469065e02b52e41188a4aa1ac366b6a87d528ca8781a412ecf3c56caae7214
|
|
BLAKE2b-256 checksum How to use checksums |
11ca230e75aed543d850f16cb4bde6ac07ab11e28b1b51605f74361e7d6ac6d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python3_json_log_formatter-1.6.1-py3-none-any.whl
| Download URL | python3_json_log_formatter-1.6.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a351b51acaddbc89bc22a1188f3e21e59dac6f2e1e355edb9c8dc9b189f3eeb
|
|
BLAKE2b-256 checksum How to use checksums |
264a6a81a388024dd3f3d2d971e4b3024086d27431a054e336400a53fdf7e80b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python3-json-log-formatter 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.