pythonjsonlogger.orjson
๐
JSON Formatter using orjson
CLASS | DESCRIPTION |
---|---|
OrjsonFormatter |
JSON formatter using orjson for encoding. |
FUNCTION | DESCRIPTION |
---|---|
orjson_default |
orjson default encoder function for non-standard types |
OrjsonFormatter
๐
OrjsonFormatter(
*args,
json_default: Optional[Callable] = orjson_default,
json_indent: bool = False,
**kwargs
)
Bases: BaseJsonFormatter
JSON formatter using orjson for encoding.
PARAMETER | DESCRIPTION |
---|---|
args
|
DEFAULT:
|
json_default
|
a function for encoding non-standard objects
TYPE:
|
json_indent
|
indent output with 2 spaces.
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.