def METHOD_NAME(self, data: Union[str, bytes]) -> None:
    """
    Replaces the current log. Remember to replay the recording afterwards.
    """
    filepath = self._location
    if isinstance(data, str):
        data = data.encode("utf-8")
    with open(filepath, "bw") as file:
        file.write(data)