python-json-logger 2.0.7__tar.gz → 3.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/LICENSE +1 -1
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/PKG-INFO +74 -39
- python-json-logger-2.0.7/src/python_json_logger.egg-info/PKG-INFO → python-json-logger-3.0.1/README.md +56 -53
- python-json-logger-3.0.1/pyproject.toml +63 -0
- python-json-logger-3.0.1/setup.cfg +4 -0
- python-json-logger-2.0.7/README.md → python-json-logger-3.0.1/src/python_json_logger.egg-info/PKG-INFO +88 -28
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/SOURCES.txt +2 -2
- python-json-logger-3.0.1/src/python_json_logger.egg-info/requires.txt +9 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/jsonlogger.py +132 -74
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/tests/test_jsonlogger.py +76 -84
- python-json-logger-2.0.7/setup.cfg +0 -34
- python-json-logger-2.0.7/setup.py +0 -41
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/MANIFEST.in +0 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/dependency_links.txt +0 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/top_level.txt +0 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/__init__.py +0 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/py.typed +0 -0
- {python-json-logger-2.0.7 → python-json-logger-3.0.1}/tests/__init__.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2011, Zakaria Zajac
|
|
1
|
+
Copyright (c) 2011, Zakaria Zajac and the python-json-logger Contributors
|
|
2
2
|
All rights reserved.
|
|
3
3
|
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -1,62 +1,93 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-json-logger
|
|
3
|
-
Version:
|
|
4
|
-
Summary:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Version: 3.0.1
|
|
4
|
+
Summary: JSON Log Formatter for the Python Logging Package
|
|
5
|
+
Author-email: Zakaria Zajac <zak@madzak.com>
|
|
6
|
+
Maintainer-email: Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
7
|
+
License: BSD-2-Clause License
|
|
8
|
+
Project-URL: GitHub, https://github.com/nhairs/python-json-logger
|
|
9
9
|
Classifier: Development Status :: 6 - Mature
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: License :: OSI Approved :: BSD License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.7
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.8
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Topic :: System :: Logging
|
|
22
|
-
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.7
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Provides-Extra: lint
|
|
26
|
+
Requires-Dist: validate-pyproject[all]; extra == "lint"
|
|
27
|
+
Requires-Dist: black; extra == "lint"
|
|
28
|
+
Requires-Dist: pylint; extra == "lint"
|
|
29
|
+
Requires-Dist: mypy; extra == "lint"
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
|
|
33
|
+

|
|
27
34
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
28
35
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
# Python JSON Logger
|
|
38
|
+
|
|
32
39
|
This library is provided to allow standard python logging to output log data as json objects. With JSON we can make our logs more readable by machines and we can stop writing custom parsers for syslog type records.
|
|
33
40
|
|
|
34
|
-
News
|
|
35
|
-
=======
|
|
36
|
-
Hi, I see this package is quiet alive and I am sorry for ignoring it so long. I will be stepping up my maintenance of this package so please allow me a week to get things back in order (and most likely a new minor version) and I'll post and update here once I am caught up.
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
==========
|
|
40
|
-
Pip:
|
|
42
|
+
### 🚨 Important 🚨
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
This repository is a maintained fork of [madzak/python-json-logger](https://github.com/madzak/python-json-logger) pending [a PEP 541 request](https://github.com/pypi/support/issues/3607) for the PyPI package. The future direction of the project is being discussed [here](https://github.com/nhairs/python-json-logger/issues/1).
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
[**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
## Installation
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
Note: All versions of this fork use version `>=3.0.0` - to use pre-fork versions use `python-json-logger<3.0.0`.
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
### Install via pip
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
=====
|
|
54
|
+
Until the PEP 541 request is complete you will need to install directly from github.
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
#### Install from GitHub
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
To install from releases:
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
# 3.0.0 wheel
|
|
62
|
+
pip install 'python-json-logger@https://github.com/nhairs/python-json-logger/releases/download/v3.0.0/python_json_logger-3.0.0-py3-none-any.whl'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To install from head:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To install a specific version from a tag:
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
# Last released version before forking
|
|
75
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git@v2.0.7'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Install from Source
|
|
79
|
+
|
|
80
|
+
```shell
|
|
81
|
+
git clone https://github.com/nhairs/python-json-logger.git
|
|
82
|
+
cd python-json-logger
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
58
87
|
|
|
59
|
-
|
|
88
|
+
### Integrating with Python's logging framework
|
|
89
|
+
|
|
90
|
+
Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
|
|
60
91
|
|
|
61
92
|
```python
|
|
62
93
|
import logging
|
|
@@ -70,7 +101,7 @@ Json outputs are provided by the JsonFormatter logging formatter. You can add th
|
|
|
70
101
|
logger.addHandler(logHandler)
|
|
71
102
|
```
|
|
72
103
|
|
|
73
|
-
|
|
104
|
+
### Customizing fields
|
|
74
105
|
|
|
75
106
|
The fmt parser can also be overidden if you want to have required fields that differ from the default of just `message`.
|
|
76
107
|
|
|
@@ -112,7 +143,7 @@ formatter = CustomJsonFormatter('%(timestamp)s %(level)s %(name)s %(message)s')
|
|
|
112
143
|
|
|
113
144
|
Items added to the log record will be included in *every* log message, no matter what the format requires.
|
|
114
145
|
|
|
115
|
-
|
|
146
|
+
### Adding custom object serialization
|
|
116
147
|
|
|
117
148
|
For custom handling of object serialization you can specify default json object translator or provide a custom encoder
|
|
118
149
|
|
|
@@ -129,7 +160,7 @@ logger.info({"special": "value", "run": 12})
|
|
|
129
160
|
logger.info("classic message", extra={"special": "value", "run": 12})
|
|
130
161
|
```
|
|
131
162
|
|
|
132
|
-
|
|
163
|
+
### Using a Config File
|
|
133
164
|
|
|
134
165
|
To use the module with a config file using the [`fileConfig` function](https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig), use the class `pythonjsonlogger.jsonlogger.JsonFormatter`. Here is a sample config file.
|
|
135
166
|
|
|
@@ -162,8 +193,7 @@ format = %(message)s
|
|
|
162
193
|
class = pythonjsonlogger.jsonlogger.JsonFormatter
|
|
163
194
|
```
|
|
164
195
|
|
|
165
|
-
Example Output
|
|
166
|
-
==============
|
|
196
|
+
## Example Output
|
|
167
197
|
|
|
168
198
|
Sample JSON with a full formatter (basically the log message from the unit test). Every log message will appear on 1 line like a typical logger.
|
|
169
199
|
|
|
@@ -191,9 +221,14 @@ Sample JSON with a full formatter (basically the log message from the unit test)
|
|
|
191
221
|
}
|
|
192
222
|
```
|
|
193
223
|
|
|
194
|
-
|
|
195
|
-
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
This project is licensed under the BSD 2 Clause License - see [`LICENSE`](https://github.com/nhairs/python-json-logger/blob/main/LICENSE)
|
|
227
|
+
|
|
228
|
+
## Authors and Maintainers
|
|
229
|
+
|
|
230
|
+
This project was originally authored by [Zakaria Zajac](https://github.com/madzak) and our wonderful [contributors](https://github.com/nhairs/python-json-logger/graphs/contributors)
|
|
196
231
|
|
|
197
|
-
|
|
232
|
+
It is currently maintained by:
|
|
198
233
|
|
|
199
|
-
- [
|
|
234
|
+
- [Nicholas Hairs](https://github.com/nhairs) - [nicholashairs.com](https://www.nicholashairs.com)
|
|
@@ -1,62 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
Name: python-json-logger
|
|
3
|
-
Version: 2.0.7
|
|
4
|
-
Summary: A python library adding a json log formatter
|
|
5
|
-
Home-page: http://github.com/madzak/python-json-logger
|
|
6
|
-
Author: Zakaria Zajac
|
|
7
|
-
Author-email: zak@madzak.com
|
|
8
|
-
License: BSD
|
|
9
|
-
Classifier: Development Status :: 6 - Mature
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Topic :: System :: Logging
|
|
22
|
-
Requires-Python: >=3.6
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE
|
|
25
|
-
|
|
26
|
-

|
|
1
|
+

|
|
27
2
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
28
3
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
29
4
|
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
# Python JSON Logger
|
|
6
|
+
|
|
32
7
|
This library is provided to allow standard python logging to output log data as json objects. With JSON we can make our logs more readable by machines and we can stop writing custom parsers for syslog type records.
|
|
33
8
|
|
|
34
|
-
News
|
|
35
|
-
=======
|
|
36
|
-
Hi, I see this package is quiet alive and I am sorry for ignoring it so long. I will be stepping up my maintenance of this package so please allow me a week to get things back in order (and most likely a new minor version) and I'll post and update here once I am caught up.
|
|
37
9
|
|
|
38
|
-
|
|
39
|
-
==========
|
|
40
|
-
Pip:
|
|
10
|
+
### 🚨 Important 🚨
|
|
41
11
|
|
|
42
|
-
|
|
12
|
+
This repository is a maintained fork of [madzak/python-json-logger](https://github.com/madzak/python-json-logger) pending [a PEP 541 request](https://github.com/pypi/support/issues/3607) for the PyPI package. The future direction of the project is being discussed [here](https://github.com/nhairs/python-json-logger/issues/1).
|
|
43
13
|
|
|
44
|
-
|
|
14
|
+
[**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
|
|
45
15
|
|
|
46
|
-
|
|
16
|
+
## Installation
|
|
47
17
|
|
|
48
|
-
|
|
18
|
+
Note: All versions of this fork use version `>=3.0.0` - to use pre-fork versions use `python-json-logger<3.0.0`.
|
|
49
19
|
|
|
50
|
-
|
|
20
|
+
### Install via pip
|
|
51
21
|
|
|
52
|
-
|
|
53
|
-
=====
|
|
22
|
+
Until the PEP 541 request is complete you will need to install directly from github.
|
|
54
23
|
|
|
55
|
-
|
|
24
|
+
#### Install from GitHub
|
|
56
25
|
|
|
57
|
-
|
|
26
|
+
To install from releases:
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
# 3.0.0 wheel
|
|
30
|
+
pip install 'python-json-logger@https://github.com/nhairs/python-json-logger/releases/download/v3.0.0/python_json_logger-3.0.0-py3-none-any.whl'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To install from head:
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To install a specific version from a tag:
|
|
40
|
+
|
|
41
|
+
```shell
|
|
42
|
+
# Last released version before forking
|
|
43
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git@v2.0.7'
|
|
44
|
+
```
|
|
58
45
|
|
|
59
|
-
|
|
46
|
+
#### Install from Source
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
git clone https://github.com/nhairs/python-json-logger.git
|
|
50
|
+
cd python-json-logger
|
|
51
|
+
pip install -e .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
### Integrating with Python's logging framework
|
|
57
|
+
|
|
58
|
+
Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
|
|
60
59
|
|
|
61
60
|
```python
|
|
62
61
|
import logging
|
|
@@ -70,7 +69,7 @@ Json outputs are provided by the JsonFormatter logging formatter. You can add th
|
|
|
70
69
|
logger.addHandler(logHandler)
|
|
71
70
|
```
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
### Customizing fields
|
|
74
73
|
|
|
75
74
|
The fmt parser can also be overidden if you want to have required fields that differ from the default of just `message`.
|
|
76
75
|
|
|
@@ -112,7 +111,7 @@ formatter = CustomJsonFormatter('%(timestamp)s %(level)s %(name)s %(message)s')
|
|
|
112
111
|
|
|
113
112
|
Items added to the log record will be included in *every* log message, no matter what the format requires.
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
### Adding custom object serialization
|
|
116
115
|
|
|
117
116
|
For custom handling of object serialization you can specify default json object translator or provide a custom encoder
|
|
118
117
|
|
|
@@ -129,7 +128,7 @@ logger.info({"special": "value", "run": 12})
|
|
|
129
128
|
logger.info("classic message", extra={"special": "value", "run": 12})
|
|
130
129
|
```
|
|
131
130
|
|
|
132
|
-
|
|
131
|
+
### Using a Config File
|
|
133
132
|
|
|
134
133
|
To use the module with a config file using the [`fileConfig` function](https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig), use the class `pythonjsonlogger.jsonlogger.JsonFormatter`. Here is a sample config file.
|
|
135
134
|
|
|
@@ -162,8 +161,7 @@ format = %(message)s
|
|
|
162
161
|
class = pythonjsonlogger.jsonlogger.JsonFormatter
|
|
163
162
|
```
|
|
164
163
|
|
|
165
|
-
Example Output
|
|
166
|
-
==============
|
|
164
|
+
## Example Output
|
|
167
165
|
|
|
168
166
|
Sample JSON with a full formatter (basically the log message from the unit test). Every log message will appear on 1 line like a typical logger.
|
|
169
167
|
|
|
@@ -191,9 +189,14 @@ Sample JSON with a full formatter (basically the log message from the unit test)
|
|
|
191
189
|
}
|
|
192
190
|
```
|
|
193
191
|
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
This project is licensed under the BSD 2 Clause License - see [`LICENSE`](https://github.com/nhairs/python-json-logger/blob/main/LICENSE)
|
|
195
|
+
|
|
196
|
+
## Authors and Maintainers
|
|
197
|
+
|
|
198
|
+
This project was originally authored by [Zakaria Zajac](https://github.com/madzak) and our wonderful [contributors](https://github.com/nhairs/python-json-logger/graphs/contributors)
|
|
196
199
|
|
|
197
|
-
|
|
200
|
+
It is currently maintained by:
|
|
198
201
|
|
|
199
|
-
- [
|
|
202
|
+
- [Nicholas Hairs](https://github.com/nhairs) - [nicholashairs.com](https://www.nicholashairs.com)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-json-logger"
|
|
7
|
+
version = "3.0.1"
|
|
8
|
+
description = "JSON Log Formatter for the Python Logging Package"
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Zakaria Zajac", email = "zak@madzak.com"},
|
|
11
|
+
]
|
|
12
|
+
maintainers = [
|
|
13
|
+
{name = "Nicholas Hairs", email = "info+python-json-logger@nicholashairs.com"},
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
# Dependency Information
|
|
17
|
+
requires-python = ">=3.7"
|
|
18
|
+
# dependencies = []
|
|
19
|
+
|
|
20
|
+
# Extra information
|
|
21
|
+
readme = "README.md"
|
|
22
|
+
license = {text = "BSD-2-Clause License"}
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 6 - Mature",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"License :: OSI Approved :: BSD License",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
+
"Programming Language :: Python :: 3.7",
|
|
30
|
+
"Programming Language :: Python :: 3.8",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Topic :: System :: Logging",
|
|
36
|
+
"Typing :: Typed",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
# homepage = "https://nhairs.github.io/python-json-logger/latest/"
|
|
41
|
+
GitHub = "https://github.com/nhairs/python-json-logger"
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
lint = [
|
|
45
|
+
"validate-pyproject[all]",
|
|
46
|
+
"black",
|
|
47
|
+
"pylint",
|
|
48
|
+
"mypy",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
test = [
|
|
52
|
+
"pytest",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
include = ["pythonjsonlogger*"]
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.package-data]
|
|
60
|
+
pythonjsonlogger = ["py.typed"]
|
|
61
|
+
|
|
62
|
+
[tool.black]
|
|
63
|
+
line-length = 100
|
|
@@ -1,37 +1,93 @@
|
|
|
1
|
-
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: python-json-logger
|
|
3
|
+
Version: 3.0.1
|
|
4
|
+
Summary: JSON Log Formatter for the Python Logging Package
|
|
5
|
+
Author-email: Zakaria Zajac <zak@madzak.com>
|
|
6
|
+
Maintainer-email: Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
7
|
+
License: BSD-2-Clause License
|
|
8
|
+
Project-URL: GitHub, https://github.com/nhairs/python-json-logger
|
|
9
|
+
Classifier: Development Status :: 6 - Mature
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: System :: Logging
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.7
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: lint
|
|
26
|
+
Requires-Dist: validate-pyproject[all]; extra == "lint"
|
|
27
|
+
Requires-Dist: black; extra == "lint"
|
|
28
|
+
Requires-Dist: pylint; extra == "lint"
|
|
29
|
+
Requires-Dist: mypy; extra == "lint"
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
|
|
33
|
+

|
|
2
34
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
3
35
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
4
36
|
|
|
5
|
-
|
|
6
|
-
|
|
37
|
+
# Python JSON Logger
|
|
38
|
+
|
|
7
39
|
This library is provided to allow standard python logging to output log data as json objects. With JSON we can make our logs more readable by machines and we can stop writing custom parsers for syslog type records.
|
|
8
40
|
|
|
9
|
-
News
|
|
10
|
-
=======
|
|
11
|
-
Hi, I see this package is quiet alive and I am sorry for ignoring it so long. I will be stepping up my maintenance of this package so please allow me a week to get things back in order (and most likely a new minor version) and I'll post and update here once I am caught up.
|
|
12
41
|
|
|
13
|
-
|
|
14
|
-
==========
|
|
15
|
-
Pip:
|
|
42
|
+
### 🚨 Important 🚨
|
|
16
43
|
|
|
17
|
-
|
|
44
|
+
This repository is a maintained fork of [madzak/python-json-logger](https://github.com/madzak/python-json-logger) pending [a PEP 541 request](https://github.com/pypi/support/issues/3607) for the PyPI package. The future direction of the project is being discussed [here](https://github.com/nhairs/python-json-logger/issues/1).
|
|
18
45
|
|
|
19
|
-
|
|
46
|
+
[**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
|
|
20
47
|
|
|
21
|
-
|
|
48
|
+
## Installation
|
|
22
49
|
|
|
23
|
-
|
|
50
|
+
Note: All versions of this fork use version `>=3.0.0` - to use pre-fork versions use `python-json-logger<3.0.0`.
|
|
24
51
|
|
|
25
|
-
|
|
52
|
+
### Install via pip
|
|
26
53
|
|
|
27
|
-
|
|
28
|
-
=====
|
|
54
|
+
Until the PEP 541 request is complete you will need to install directly from github.
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
#### Install from GitHub
|
|
31
57
|
|
|
32
|
-
|
|
58
|
+
To install from releases:
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
# 3.0.0 wheel
|
|
62
|
+
pip install 'python-json-logger@https://github.com/nhairs/python-json-logger/releases/download/v3.0.0/python_json_logger-3.0.0-py3-none-any.whl'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To install from head:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To install a specific version from a tag:
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
# Last released version before forking
|
|
75
|
+
pip install 'python-json-logger@git+https://github.com/nhairs/python-json-logger.git@v2.0.7'
|
|
76
|
+
```
|
|
33
77
|
|
|
34
|
-
|
|
78
|
+
#### Install from Source
|
|
79
|
+
|
|
80
|
+
```shell
|
|
81
|
+
git clone https://github.com/nhairs/python-json-logger.git
|
|
82
|
+
cd python-json-logger
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### Integrating with Python's logging framework
|
|
89
|
+
|
|
90
|
+
Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
|
|
35
91
|
|
|
36
92
|
```python
|
|
37
93
|
import logging
|
|
@@ -45,7 +101,7 @@ Json outputs are provided by the JsonFormatter logging formatter. You can add th
|
|
|
45
101
|
logger.addHandler(logHandler)
|
|
46
102
|
```
|
|
47
103
|
|
|
48
|
-
|
|
104
|
+
### Customizing fields
|
|
49
105
|
|
|
50
106
|
The fmt parser can also be overidden if you want to have required fields that differ from the default of just `message`.
|
|
51
107
|
|
|
@@ -87,7 +143,7 @@ formatter = CustomJsonFormatter('%(timestamp)s %(level)s %(name)s %(message)s')
|
|
|
87
143
|
|
|
88
144
|
Items added to the log record will be included in *every* log message, no matter what the format requires.
|
|
89
145
|
|
|
90
|
-
|
|
146
|
+
### Adding custom object serialization
|
|
91
147
|
|
|
92
148
|
For custom handling of object serialization you can specify default json object translator or provide a custom encoder
|
|
93
149
|
|
|
@@ -104,7 +160,7 @@ logger.info({"special": "value", "run": 12})
|
|
|
104
160
|
logger.info("classic message", extra={"special": "value", "run": 12})
|
|
105
161
|
```
|
|
106
162
|
|
|
107
|
-
|
|
163
|
+
### Using a Config File
|
|
108
164
|
|
|
109
165
|
To use the module with a config file using the [`fileConfig` function](https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig), use the class `pythonjsonlogger.jsonlogger.JsonFormatter`. Here is a sample config file.
|
|
110
166
|
|
|
@@ -137,8 +193,7 @@ format = %(message)s
|
|
|
137
193
|
class = pythonjsonlogger.jsonlogger.JsonFormatter
|
|
138
194
|
```
|
|
139
195
|
|
|
140
|
-
Example Output
|
|
141
|
-
==============
|
|
196
|
+
## Example Output
|
|
142
197
|
|
|
143
198
|
Sample JSON with a full formatter (basically the log message from the unit test). Every log message will appear on 1 line like a typical logger.
|
|
144
199
|
|
|
@@ -166,9 +221,14 @@ Sample JSON with a full formatter (basically the log message from the unit test)
|
|
|
166
221
|
}
|
|
167
222
|
```
|
|
168
223
|
|
|
169
|
-
|
|
170
|
-
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
This project is licensed under the BSD 2 Clause License - see [`LICENSE`](https://github.com/nhairs/python-json-logger/blob/main/LICENSE)
|
|
227
|
+
|
|
228
|
+
## Authors and Maintainers
|
|
229
|
+
|
|
230
|
+
This project was originally authored by [Zakaria Zajac](https://github.com/madzak) and our wonderful [contributors](https://github.com/nhairs/python-json-logger/graphs/contributors)
|
|
171
231
|
|
|
172
|
-
|
|
232
|
+
It is currently maintained by:
|
|
173
233
|
|
|
174
|
-
- [
|
|
234
|
+
- [Nicholas Hairs](https://github.com/nhairs) - [nicholashairs.com](https://www.nicholashairs.com)
|
{python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/SOURCES.txt
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.md
|
|
4
|
-
|
|
5
|
-
setup.py
|
|
4
|
+
pyproject.toml
|
|
6
5
|
src/python_json_logger.egg-info/PKG-INFO
|
|
7
6
|
src/python_json_logger.egg-info/SOURCES.txt
|
|
8
7
|
src/python_json_logger.egg-info/dependency_links.txt
|
|
8
|
+
src/python_json_logger.egg-info/requires.txt
|
|
9
9
|
src/python_json_logger.egg-info/top_level.txt
|
|
10
10
|
src/pythonjsonlogger/__init__.py
|
|
11
11
|
src/pythonjsonlogger/jsonlogger.py
|