def _open(self) -> TextIOWrapper:
        """Open a new log file and assign permissions.

        :returns: the resulting stream.
        """
        ret = super(PatroniFileHandler, self)._open()
        os.chmod(self.baseFilename, self._log_file_mode)
        return ret
Open a new log file and assign permissions.

        :returns: the resulting stream.
        
patroni/log.py