def format(self, record: logging.LogRecord) -> str:
msg: Union[str, dict] = record.msg<EOL>if not isinstance(record.msg, dict):<EOL><INDENT>msg = {self.default_msg_fieldname: msg}<EOL><DEDENT>if record.exc_info:  <EOL><INDENT>msg["<STR_LIT>"] = record.exc_info<EOL><DEDENT>if record.exc_text:  <EOL><INDENT>msg["<STR_LIT>"] = record.exc_text  <EOL><DEDENT>return self.serializer(msg, default=self._default_handler)<EOL>
Formats a record and serializes it as a JSON str. If record message isnt
already a dict, initializes a new dict and uses `default_msg_fieldname`
as a key as the record msg as the value.