code: def format_record(record):
      
  
      record = dict(
          (key, getattr(record, key, None))
          for key in (
              "threadName",
              "name",
              "thread",
              "created",
              "process",
              "processName",
              "args",
              "module",
              "filename",
              "levelno",
              "exc_text",
              "pathname",
              "lineno",
              "msg",
              "exc_info",
              "funcName",
              "relativeCreated",
              "levelname",
              "msecs")
      )
  
      # Humanise output and conform to Exceptions
      record["message"] = str(record.pop("msg"))
  
      if os.getenv("PYBLISH_SAFE"):
          schema.validate(record, "record")
  
      return record
docs: Serialise LogRecord instance