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.
Files changed (18) hide show
  1. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/LICENSE +1 -1
  2. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/PKG-INFO +74 -39
  3. python-json-logger-2.0.7/src/python_json_logger.egg-info/PKG-INFO → python-json-logger-3.0.1/README.md +56 -53
  4. python-json-logger-3.0.1/pyproject.toml +63 -0
  5. python-json-logger-3.0.1/setup.cfg +4 -0
  6. python-json-logger-2.0.7/README.md → python-json-logger-3.0.1/src/python_json_logger.egg-info/PKG-INFO +88 -28
  7. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/SOURCES.txt +2 -2
  8. python-json-logger-3.0.1/src/python_json_logger.egg-info/requires.txt +9 -0
  9. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/jsonlogger.py +132 -74
  10. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/tests/test_jsonlogger.py +76 -84
  11. python-json-logger-2.0.7/setup.cfg +0 -34
  12. python-json-logger-2.0.7/setup.py +0 -41
  13. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/MANIFEST.in +0 -0
  14. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/dependency_links.txt +0 -0
  15. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/python_json_logger.egg-info/top_level.txt +0 -0
  16. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/__init__.py +0 -0
  17. {python-json-logger-2.0.7 → python-json-logger-3.0.1}/src/pythonjsonlogger/py.typed +0 -0
  18. {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: 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
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
- Requires-Python: >=3.6
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.7
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
-
26
- ![Build Status](https://github.com/madzak/python-json-logger/actions/workflows/build.yml/badge.svg)
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
+ ![Build Status](https://github.com/nhairs/python-json-logger/actions/workflows/test-suite.yml/badge.svg)
27
34
  [![License](https://img.shields.io/pypi/l/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
28
35
  [![Version](https://img.shields.io/pypi/v/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
29
36
 
30
- Overview
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
- Installing
39
- ==========
40
- Pip:
42
+ ### 🚨 Important 🚨
41
43
 
42
- pip install python-json-logger
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
- Pypi:
46
+ [**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
45
47
 
46
- https://pypi.python.org/pypi/python-json-logger
48
+ ## Installation
47
49
 
48
- Manual:
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
- python setup.py install
52
+ ### Install via pip
51
53
 
52
- Usage
53
- =====
54
+ Until the PEP 541 request is complete you will need to install directly from github.
54
55
 
55
- ## Integrating with Python's logging framework
56
+ #### Install from GitHub
56
57
 
57
- Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
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
- **Please note: version 0.1.0 has changed the import structure, please update to the following example for proper importing**
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
- ## Customizing fields
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
- ## Adding custom object serialization
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
- ## Using a Config File
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
- External Examples
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
- - [Wesley Tanaka - Structured log files in Python using python-json-logger](http://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
232
+ It is currently maintained by:
198
233
 
199
- - [Archive](https://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
234
+ - [Nicholas Hairs](https://github.com/nhairs) - [nicholashairs.com](https://www.nicholashairs.com)
@@ -1,62 +1,61 @@
1
- Metadata-Version: 2.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
- ![Build Status](https://github.com/madzak/python-json-logger/actions/workflows/build.yml/badge.svg)
1
+ ![Build Status](https://github.com/nhairs/python-json-logger/actions/workflows/test-suite.yml/badge.svg)
27
2
  [![License](https://img.shields.io/pypi/l/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
28
3
  [![Version](https://img.shields.io/pypi/v/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
29
4
 
30
- Overview
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
- Installing
39
- ==========
40
- Pip:
10
+ ### 🚨 Important 🚨
41
11
 
42
- pip install python-json-logger
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
- Pypi:
14
+ [**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
45
15
 
46
- https://pypi.python.org/pypi/python-json-logger
16
+ ## Installation
47
17
 
48
- Manual:
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
- python setup.py install
20
+ ### Install via pip
51
21
 
52
- Usage
53
- =====
22
+ Until the PEP 541 request is complete you will need to install directly from github.
54
23
 
55
- ## Integrating with Python's logging framework
24
+ #### Install from GitHub
56
25
 
57
- Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
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
- **Please note: version 0.1.0 has changed the import structure, please update to the following example for proper importing**
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
- ## Customizing fields
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
- ## Adding custom object serialization
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
- ## Using a Config File
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
- External Examples
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
- - [Wesley Tanaka - Structured log files in Python using python-json-logger](http://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
200
+ It is currently maintained by:
198
201
 
199
- - [Archive](https://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
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
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,37 +1,93 @@
1
- ![Build Status](https://github.com/madzak/python-json-logger/actions/workflows/build.yml/badge.svg)
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
+ ![Build Status](https://github.com/nhairs/python-json-logger/actions/workflows/test-suite.yml/badge.svg)
2
34
  [![License](https://img.shields.io/pypi/l/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
3
35
  [![Version](https://img.shields.io/pypi/v/python-json-logger.svg)](https://pypi.python.org/pypi/python-json-logger/)
4
36
 
5
- Overview
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
- Installing
14
- ==========
15
- Pip:
42
+ ### 🚨 Important 🚨
16
43
 
17
- pip install python-json-logger
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
- Pypi:
46
+ [**Changelog**](https://github.com/nhairs/python-json-logger/blob/main/CHANGELOG.md)
20
47
 
21
- https://pypi.python.org/pypi/python-json-logger
48
+ ## Installation
22
49
 
23
- Manual:
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
- python setup.py install
52
+ ### Install via pip
26
53
 
27
- Usage
28
- =====
54
+ Until the PEP 541 request is complete you will need to install directly from github.
29
55
 
30
- ## Integrating with Python's logging framework
56
+ #### Install from GitHub
31
57
 
32
- Json outputs are provided by the JsonFormatter logging formatter. You can add the custom formatter like below:
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
- **Please note: version 0.1.0 has changed the import structure, please update to the following example for proper importing**
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
- ## Customizing fields
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
- ## Adding custom object serialization
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
- ## Using a Config File
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
- External Examples
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
- - [Wesley Tanaka - Structured log files in Python using python-json-logger](http://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
232
+ It is currently maintained by:
173
233
 
174
- - [Archive](https://web.archive.org/web/20201130054012/https://wtanaka.com/node/8201)
234
+ - [Nicholas Hairs](https://github.com/nhairs) - [nicholashairs.com](https://www.nicholashairs.com)
@@ -1,11 +1,11 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
- setup.cfg
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
@@ -0,0 +1,9 @@
1
+
2
+ [lint]
3
+ validate-pyproject[all]
4
+ black
5
+ pylint
6
+ mypy
7
+
8
+ [test]
9
+ pytest