]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Change logging method
authorKarel Kočí <cynerd@email.cz>
Fri, 24 Jul 2015 06:38:40 +0000 (08:38 +0200)
committerKarel Kočí <cynerd@email.cz>
Fri, 24 Jul 2015 06:38:40 +0000 (08:38 +0200)
Now every execution is in separated file.
Also logging folder creation moved from callprocess tto initialize.base

scripts/initialize.py
scripts/utils.py

index 96ba0b0b54eb52e6f1452bd63e715170184d6552..36da24db9bf6d951cfb5e54dd587421a296f0f99 100755 (executable)
@@ -26,7 +26,9 @@ def all():
 
 def base():
        print('Initialize base...')
-       try: os.mkdir(sf(conf.build_folder))
+       try:
+               os.mkdir(sf(conf.build_folder))
+               os.mkdir(sf(conf.log_folder))
        except FileExistsError:
                pass
 
index 9c83065d7e2389586b648a6e55689ac0c30db04d..0d7f67a3f5c1a7f04d335912a6ce31b16b840cbb 100644 (file)
@@ -57,16 +57,12 @@ def build_conf_map():
 
 def callsubprocess(process_name, process, show_output = True, regular = "",
                env=os.environ):
-       try:
-               os.mkdir(sf(conf.log_folder))
-       except OSError:
-               pass
-
        sprc = subprocess.Popen(process, stdout = subprocess.PIPE, env = env)
 
        rtn = ""
-       with open(os.path.join(sf(conf.log_folder), process_name + ".log"), "a") as f:
-               f.write("::" + time.strftime("%y-%m-%d-%H-%M-%S") + "::\n")
+       with open(os.path.join(sf(conf.log_folder),
+                       process_name + '-' + time.strftime("%y-%m-%d-%H-%M-%S") + ".log"),
+                       "w") as f:
                for linen in sprc.stdout:
                        line = linen.decode(sys.getdefaultencoding())
                        f.write(line)