aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-07-24 08:38:40 +0200
committerKarel Kočí <cynerd@email.cz>2015-07-24 08:38:40 +0200
commit2d887e3e5563ba478ff17e106f7a5c629880bcc3 (patch)
tree3dd7b203db913a32c3e94984c3a5c74c3438579b /scripts
parentc2acf3fac67a8750b4ea40d901d18f81ee7e8c7a (diff)
downloadlinux-conf-perf-2d887e3e5563ba478ff17e106f7a5c629880bcc3.tar.gz
linux-conf-perf-2d887e3e5563ba478ff17e106f7a5c629880bcc3.tar.bz2
linux-conf-perf-2d887e3e5563ba478ff17e106f7a5c629880bcc3.zip
Change logging method
Now every execution is in separated file. Also logging folder creation moved from callprocess tto initialize.base
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/initialize.py4
-rw-r--r--scripts/utils.py10
2 files changed, 6 insertions, 8 deletions
diff --git a/scripts/initialize.py b/scripts/initialize.py
index 96ba0b0..36da24d 100755
--- a/scripts/initialize.py
+++ b/scripts/initialize.py
@@ -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
diff --git a/scripts/utils.py b/scripts/utils.py
index 9c83065..0d7f67a 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -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)