]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Return timestamp to subprocess execution log
authorKarel Kočí <cynerd@email.cz>
Fri, 24 Jul 2015 08:44:31 +0000 (10:44 +0200)
committerKarel Kočí <cynerd@email.cz>
Fri, 24 Jul 2015 08:44:31 +0000 (10:44 +0200)
When script is running, this function could be executed multiple times in same second.
If it would happen, it wouldn't be easy find where starts which execution.

scripts/utils.py

index 0d7f67a3f5c1a7f04d335912a6ce31b16b840cbb..2c2026218a5f6f016472bc489ed608551b8ac996 100644 (file)
@@ -62,7 +62,8 @@ def callsubprocess(process_name, process, show_output = True, regular = "",
        rtn = ""
        with open(os.path.join(sf(conf.log_folder),
                        process_name + '-' + time.strftime("%y-%m-%d-%H-%M-%S") + ".log"),
-                       "w") as f:
+                       "a") as f:
+               f.write('::' + time.strftime("%y-%m-%d-%H-%M-%S-%f") + '::')
                for linen in sprc.stdout:
                        line = linen.decode(sys.getdefaultencoding())
                        f.write(line)