def opt_log_format(self, format):
        """
        Log file format.
        (options: "text", "json"; default: "text" if the log file is a tty,
        otherwise "json")
        """
        format = format.lower()

        if format == "text":
            self["fileLogObserverFactory"] = textFileLogObserver
        elif format == "json":
            self["fileLogObserverFactory"] = jsonFileLogObserver
        else:
            raise UsageError("Invalid log format: {}".format(format))
        self["logFormat"] = format

        Log file format.
        (options: "text", "json"; default: "text" if the log file is a tty,
        otherwise "json")
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/application/twist/_options.py