[winswitch] Why use user provided log file only when display_name is set?

Timothy Hobbs timothy at hobbs.cz
Fri Mar 17 22:34:12 GMT 2017


Hi,

I'm reading the xpra code now, and I don't understand the following 
condition:

668    def select_log_file(log_dir, log_file, display_name):
669        """ returns the log file path we should be using given the 
parameters,
670            this may return a temporary logpath if display_name is 
not available.
671        """
672        if log_file and display_name:
673            if os.path.isabs(log_file):
674                logpath = log_file
675            else:
676                logpath = os.path.join(log_dir, log_file)
677            logpath = shellsub(logpath, {"DISPLAY" : display_name})
678        elif display_name:
679            logpath = norm_makepath(log_dir, display_name) + ".log"
680        else:
681            logpath = os.path.join(log_dir, "tmp_%d.log" % os.getpid())
682        return logpath

https://www.xpra.org/trac/browser/xpra/trunk/src/xpra/scripts/server.py#L672

On line 672 the condition is that display_name must be set in order for 
the user set log_file option to be used. However, looking at the code, I 
see no reason for this to be the case. So why is it needed?

Why not just

672        if log_file:
673            if os.path.isabs(log_file):
674                logpath = log_file
....


Regards,

Timothy Hobbs




More information about the shifter-users mailing list