runtime
472 / 500
question 472 Observability & Operations · easy

The formatter that breaks on quotes

The log shipper rejects some lines from the ingest service as invalid JSON. It turns out to be every line whose message or field contains a double quote or a backslash, such as reasons like Expecting "," delimiter. Fix JsonFormatter so every line it writes is valid JSON with the same fields.

ClassJsonFormatter(logging.Formatter)
Each linea JSON object with level, message and, when present, reason

Loading your progress…

The formatter that breaks on quotes — Python practice · Runtime