protonfixes icon indicating copy to clipboard operation
protonfixes copied to clipboard

Log to more file with more descriptive name

Open MithicSpirit opened this issue 2 years ago • 1 comments

/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.

MithicSpirit avatar Feb 10 '22 02:02 MithicSpirit

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, ...).

pchome avatar Feb 19 '22 13:02 pchome