pythonjsonlogger.msgspec
🔗
JSON Formatter using msgspec
CLASS | DESCRIPTION |
---|---|
MsgspecFormatter |
JSON formatter using |
FUNCTION | DESCRIPTION |
---|---|
msgspec_default |
msgspec default encoder function for non-standard types |
MsgspecFormatter
🔗
MsgspecFormatter(
*args,
json_default: Optional[Callable] = msgspec_default,
**kwargs
)
Bases: BaseJsonFormatter
JSON formatter using msgspec.json.Encoder
for encoding.
PARAMETER | DESCRIPTION |
---|---|
args
|
DEFAULT:
|
json_default
|
a function for encoding non-standard objects
TYPE:
|
kwargs
|
DEFAULT:
|
METHOD | DESCRIPTION |
---|---|
add_fields |
Extract fields from a LogRecord for logging |
format |
Formats a log record and serializes to json |
formatException |
Format and return the specified exception information. |
formatStack |
Format and return the specified stack information. |
jsonify_log_record |
Returns a json string of the log data. |
parse |
Parses format string looking for substitutions |
process_log_record |
Custom processing of the data to be logged. |
serialize_log_record |
Returns the final representation of the data to be logged |
add_fields
🔗
Extract fields from a LogRecord for logging
This method can be overridden to implement custom logic for adding fields.
PARAMETER | DESCRIPTION |
---|---|
log_data
|
data that will be logged |
record
|
the record to extract data from
TYPE:
|
message_dict
|
dictionary that was logged instead of a message. e.g
|
Changed in 4.0: log_record
renamed to log_data
format
🔗
Formats a log record and serializes to json
PARAMETER | DESCRIPTION |
---|---|
record
|
the record to format
TYPE:
|
formatException
🔗
Format and return the specified exception information.
If exc_info_as_array is set to True, This method returns an array of strings.
formatStack
🔗
Format and return the specified stack information.
If stack_info_as_array is set to True, This method returns an array of strings.
jsonify_log_record
🔗
Returns a json string of the log data.