Releases: nhairs/python-json-logger
3.2.0
3.2.0 - 2024-12-11
Changed
pythonjsonlogger.[ORJSON,MSGSPEC]_AVAILABLE
no longer imports the respective package when determining availability.pythonjsonlogger.[orjson,msgspec]
now throws apythonjsonlogger.exception.MissingPackageError
when required libraries are not available. These contain more information about what is missing whilst still being anImportError
.defaults
parameter is no longer ignored and now conforms to the standard library. Setting a defaults dictionary will add the specified keys if the those keys do not exist in a record or weren't passed by theextra
parameter when logging a message.typing_extensions
is only installed on Python version < 3.10.- Support Python 3.13
msgspec
has only been tested against pre-release versions.
v3.1.0
3.1.0 - 2023-05-28
This splits common funcitonality out to allow supporting other JSON encoders. Although this is a large refactor, backwards compatibility has been maintained.
Added
pythonjsonlogger.core
- more details below.pythonjsonlogger.defaults
module that provides many functions for handling unsupported types.- Orjson encoder support via
pythonjsonlogger.orjson.OrjsonFormatter
with the following additions:- bytes are URL safe base64 encoded.
- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum values use their value, Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- MsgSpec encoder support via
pythonjsonlogger.msgspec.MsgspecFormatter
with the following additions:- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- Note: msgspec only supprts enum values of type
int
orstr
jcrist/msgspec#680
- Exceptions are "pretty printed" using the exception name and message e.g.
Changed
pythonjsonlogger.jsonlogger
has been moved topythonjsonlogger.json
with core functionality moved topythonjsonlogger.core
.pythonjsonlogger.core.BaseJsonFormatter
properly supports alllogging.Formatter
arguments:fmt
is unchanged.datefmt
is unchanged.style
can now support non-standard arguments by settingvalidate
toFalse
validate
allows non-standardstyle
arguments or prevents callingvalidate
on standardstyle
arguments.default
is ignored.
pythonjsonlogger.json.JsonFormatter
default encodings changed:- bytes are URL safe base64 encoded.
- Exception formatting detected using
BaseException
instead ofException
. Now "pretty prints" the exception using the exception name and message e.g."ValueError: bad value passed"
- Dataclasses are now supported
- Enum values now use their value, Enum classes now return all values as a list.
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- Renaming fields now preserves order (#7) and ignores missing fields (#6).
- Documentation
- Generated documentation using
mkdocs
is stored indocs/
- Documentation within
README.md
has been moved todocs/index.md
anddocs/qucikstart.md
. CHANGELOG.md
has been moved todocs/change-log.md
SECURITY.md
has been moved and replaced with a symbolic link todocs/security.md
.
- Generated documentation using
Deprecated
pythonjsonlogger.jsonlogger
is nowpythonjsonlogger.json
pythonjsonlogger.jsonlogger.RESERVED_ATTRS
is nowpythonjsonlogger.core.RESERVED_ATTRS
.pythonjsonlogger.jsonlogger.merge_record_extra
is nowpythonjsonlogger.core.merge_record_extra
.
Removed
- Python 3.7 support dropped
pythonjsonlogger.jsonlogger.JsonFormatter._str_to_fn
replaced withpythonjsonlogger.core.str_to_object
.
v3.1.0.rc3
3.1.0.rc3 - 2023-05-03
This splits common funcitonality out to allow supporting other JSON encoders. Although this is a large refactor, backwards compatibility has been maintained.
Added
.core
- more details below..defaults
module that provides many functions for handling unsupported types.- Orjson encoder support via
.orjson.OrjsonFormatter
with the following additions:- bytes are URL safe base64 encoded.
- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum values use their value, Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- MsgSpec encoder support via
.msgspec.MsgspecFormatter
with the following additions:- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- Note: msgspec only supprts enum values of type
int
orstr
jcrist/msgspec#680
- Exceptions are "pretty printed" using the exception name and message e.g.
Changed
.jsonlogger
has been moved to.json
with core functionality moved to.core
..core.BaseJsonFormatter
properly supports alllogging.Formatter
arguments:fmt
is unchanged.datefmt
is unchanged.style
can now support non-standard arguments by settingvalidate
toFalse
validate
allows non-standardstyle
arguments or prevents callingvalidate
on standardstyle
arguments.default
is ignored.
.json.JsonEncoder
default encodings changed:- bytes are URL safe base64 encoded.
- Exception formatting detected using
BaseException
instead ofException
. Now "pretty prints" the exception using the exception name and message e.g."ValueError: bad value passed"
- Dataclasses are now supported
- Enum values now use their value, Enum classes now return all values as a list.
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- Renaming fields now preserves order (#7) and ignores missing fields (#6).
Deprecated
.jsonlogger
is now.json
.jsonlogger.RESERVED_ATTRS
is now.core.RESERVED_ATTRS
..jsonlogger.merge_record_extra
is now.core.merge_record_extra
.
Removed
- Python 3.7 support dropped
.jsonlogger.JsonFormatter._str_to_fn
replaced with.core.str_to_object
.
v3.1.0.rc2
3.1.0.rc2 - 2023-05-03
This splits common funcitonality out to allow supporting other JSON encoders. Although this is a large refactor, backwards compatibility has been maintained.
Added
.core
- more details below..defaults
module that provides many functions for handling unsupported types.- Orjson encoder support via
.orjson.OrjsonFormatter
with the following additions:- bytes are URL safe base64 encoded.
- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum values use their value, Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- MsgSpec encoder support via
.msgspec.MsgspecFormatter
with the following additions:- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed"
- Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
- Note: msgspec only supprts enum values of type
int
orstr
jcrist/msgspec#680
- Exceptions are "pretty printed" using the exception name and message e.g.
Changed
.jsonlogger
has been moved to.json
with core functionality moved to.core
..core.BaseJsonFormatter
properly supports alllogging.Formatter
arguments:fmt
is unchanged.datefmt
is unchanged.style
can now support non-standard arguments by settingvalidate
toFalse
validate
allows non-standardstyle
arguments or prevents callingvalidate
on standardstyle
arguments.default
is ignored.
.json.JsonEncoder
default encodings changed:- bytes are URL safe base64 encoded.
- Exception formatting detected using
BaseException
instead ofException
. Now "pretty prints" the exception using the exception name and message e.g."ValueError: bad value passed"
- Dataclasses are now supported
- Enum values now use their value, Enum classes now return all values as a list.
- Will fallback on
__str__
if available, else__repr__
if available, else will use__could_not_encode__
Deprecated
.jsonlogger
is now.json
.jsonlogger.RESERVED_ATTRS
is now.core.RESERVED_ATTRS
..jsonlogger.merge_record_extra
is now.core.merge_record_extra
.
Removed
- Python 3.7 support dropped
.jsonlogger.JsonFormatter._str_to_fn
replaced with.core.str_to_object
.
v3.1.0.rc1
3.1.0.rc1 - 2023-05-03
This splits common funcitonality out to allow supporting other JSON encoders. Although this is a large refactor, backwards compatibility has been maintained.
Added
.core
- more details below.- Orjson encoder support via
.orjson.OrjsonFormatter
. - MsgSpec encoder support via
.msgspec.MsgspecFormatter
.
Changed
.jsonlogger
has been moved to.json
with core functionality moved to.core
..core.BaseJsonFormatter
properly supports alllogging.Formatter
arguments:fmt
is unchanged.datefmt
is unchanged.style
can now support non-standard arguments by settingvalidate
toFalse
validate
allows non-standardstyle
arguments or prevents callingvalidate
on standardstyle
arguments.default
is ignored.
Deprecated
.jsonlogger
is now.json
.jsonlogger.RESERVED_ATTRS
is now.core.RESERVED_ATTRS
..jsonlogger.merge_record_extra
is now.core.merge_record_extra
.
Removed
- Python 3.7 support dropped
.jsonlogger.JsonFormatter._str_to_fn
replaced with.core.str_to_object
.
v3.0.1
v3.0.0
Note: using new major version to separate changes from this fork and the original (upstream). See #1 for details.
Changes
- Update supported Python versions - @nhairs
- Drop 3.6
- The following versions are supported and tested:
- CPython 3.7-3.12 (ubuntu, windows, mac)
- PyPy 3.7-3.10 (ubuntu, wundows, mac)
RESERVED_ATTRS
is now a list and version dependent
- Fix
JsonFormatter.__init__
return type (None
) - @nhairs - Moved to
pyproject.toml
- @nhairs - Update linting and testing - @nhairs
- Split lint and test steps in GHA
- Use validate-pyproject, black, pylint, mypy
New Contributors
Full Changelog: v2.0.7...v3.0.0