Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log even when SteamGameId is not set #7400

Open
wants to merge 1 commit into
base: proton_8.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions proton
Original file line number Diff line number Diff line change
Expand Up @@ -1346,20 +1346,14 @@ class Session:
except (OSError, IOError, TypeError, KeyError):
pass

def setup_logging(self, *, append_forever):
def setup_logging(self):
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"
#SteamGameId is not always available
lfile_path = basedir + "/steam-" + os.environ.get("SteamGameId", "proton") + ".log"

if file_exists(lfile_path, follow_symlinks=False):
os.remove(lfile_path)
if file_exists(lfile_path, follow_symlinks=False):
os.remove(lfile_path)

makedirs(basedir)
self.log_file = open(lfile_path, "a")
Expand Down Expand Up @@ -1480,7 +1474,7 @@ class Session:
self.env["WINE_CRASH_REPORT_DIR"] = self.env["PROTON_CRASH_REPORT_DIR"]

if "PROTON_LOG" in self.env and nonzero(self.env["PROTON_LOG"]):
if self.setup_logging(append_forever=False):
if self.setup_logging():
self.log_file.write("======================\n")
with open(g_proton.version_file, "r") as f:
self.log_file.write("Proton: " + f.readline().strip() + "\n")
Expand Down