def __call__(self, event):
        """
        Write event to file.

        @param event: An event.
        @type event: L{dict}
        """
        text = self.formatEvent(event)

        if text is None:
            text = u""

        if self._encoding is not None:
            text = text.encode(self._encoding)

        if text:
            self._outFile.write(text)
            self._outFile.flush()

        Write event to file.

        @param event: An event.
        @type event: L{dict}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_file.py