simons-public / protonfixes

A module for applying fixes at runtime to unsupported games with Steam Proton without changing game installation files
https://simons-public.github.io/protonfixes/
Other
232 stars 117 forks source link

Log to more file with more descriptive name #169

Open MithicSpirit opened 2 years ago

MithicSpirit commented 2 years ago

/tmp/test is a hardcoded logfile which is quite non-descriptive. It would be nice if this was changed to something a bit clearer like /tmp/protonfixes.log, or maybe even make a proper temporary file with randomized unique prefix. The ideal solution would be to make the logfile configurable, but this might be a bit overkill.

pchome commented 2 years ago

I have a patch for a while for multi-user logs support

diff --git a/protonfixes/logger.py b/protonfixes/logger.py
index e0a3489..6d903c0 100644
--- a/protonfixes/logger.py
+++ b/protonfixes/logger.py
@@ -38,7 +38,8 @@ class Log():
         fulltext = color + pfx + str(msg) + reset + os.linesep
         sys.stderr.write(fulltext)
         sys.stderr.flush()
-        with io.open('/tmp/test', 'a', 1, encoding='utf-8') as testfile:
+        filename = '/tmp/'+ os.environ['USER'] +'-protonfixes-test'
+        with io.open(filename, 'a', 1, encoding='utf-8') as testfile:
             testfile.write(logtext)

so file names will be like /tmp/username-protonfixes-test, but looking into /tmp I see other programs usually put user name, user id or unique suffix at the end of file or directory name. Similar change should be made for generated config files (dxvk). Also this configs is the reason why I decided to use current user name as a prefix (username-protonfixes-test,username-protonfixes_dxvk.conf, ...).