mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-02-04 01:30:36 +03:00
proton: More easily enable always-on logging
This commit is contained in:
parent
f27ab32edb
commit
7ff77df377
29
proton
29
proton
@ -735,6 +735,25 @@ class Session:
|
|||||||
except (OSError, IOError, TypeError, KeyError):
|
except (OSError, IOError, TypeError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def setup_logging(self, append_forever=False):
|
||||||
|
basedir = self.env.get("PROTON_LOG_DIR", os.environ["HOME"])
|
||||||
|
|
||||||
|
if append_forever:
|
||||||
|
#SteamGameId is not always available
|
||||||
|
lfile_path = basedir + "/steam-proton.log"
|
||||||
|
else:
|
||||||
|
if not "SteamGameId" in os.environ:
|
||||||
|
return False
|
||||||
|
|
||||||
|
lfile_path = basedir + "/steam-" + os.environ["SteamGameId"] + ".log"
|
||||||
|
|
||||||
|
if os.path.exists(lfile_path):
|
||||||
|
os.remove(lfile_path)
|
||||||
|
|
||||||
|
makedirs(basedir)
|
||||||
|
self.log_file = open(lfile_path, "a")
|
||||||
|
return True
|
||||||
|
|
||||||
def init_session(self, update_prefix_files):
|
def init_session(self, update_prefix_files):
|
||||||
self.env["WINEPREFIX"] = g_compatdata.prefix_dir
|
self.env["WINEPREFIX"] = g_compatdata.prefix_dir
|
||||||
|
|
||||||
@ -828,20 +847,16 @@ class Session:
|
|||||||
if "PROTON_CRASH_REPORT_DIR" in self.env:
|
if "PROTON_CRASH_REPORT_DIR" in self.env:
|
||||||
self.env["WINE_CRASH_REPORT_DIR"] = self.env["PROTON_CRASH_REPORT_DIR"]
|
self.env["WINE_CRASH_REPORT_DIR"] = self.env["PROTON_CRASH_REPORT_DIR"]
|
||||||
|
|
||||||
if "SteamGameId" in self.env:
|
|
||||||
if self.env["WINEDEBUG"] != "-all":
|
if self.env["WINEDEBUG"] != "-all":
|
||||||
basedir = self.env.get("PROTON_LOG_DIR", os.environ["HOME"])
|
if self.setup_logging(append_forever=False):
|
||||||
makedirs(basedir)
|
|
||||||
lfile_path = basedir + "/steam-" + os.environ["SteamGameId"] + ".log"
|
|
||||||
if os.path.exists(lfile_path):
|
|
||||||
os.remove(lfile_path)
|
|
||||||
self.log_file = open(lfile_path, "a")
|
|
||||||
self.log_file.write("======================\n")
|
self.log_file.write("======================\n")
|
||||||
with open(g_proton.version_file, "r") as f:
|
with open(g_proton.version_file, "r") as f:
|
||||||
self.log_file.write("Proton: " + f.readline().strip() + "\n")
|
self.log_file.write("Proton: " + f.readline().strip() + "\n")
|
||||||
|
if "SteamGameId" in self.env:
|
||||||
self.log_file.write("SteamGameId: " + self.env["SteamGameId"] + "\n")
|
self.log_file.write("SteamGameId: " + self.env["SteamGameId"] + "\n")
|
||||||
self.log_file.write("Command: " + str(sys.argv[2:] + self.cmdlineappend) + "\n")
|
self.log_file.write("Command: " + str(sys.argv[2:] + self.cmdlineappend) + "\n")
|
||||||
self.log_file.write("Options: " + str(self.compat_config) + "\n")
|
self.log_file.write("Options: " + str(self.compat_config) + "\n")
|
||||||
|
|
||||||
self.try_log_slr_versions()
|
self.try_log_slr_versions()
|
||||||
|
|
||||||
#dump some important variables into the log header
|
#dump some important variables into the log header
|
||||||
|
Loading…
x
Reference in New Issue
Block a user