ttidier stdout for logging - amprolla - devuan's apt repo merger
HTML git clone git://parazyd.org/amprolla.git
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit e977c9e07f177e8bc2b51265de1bc93475397f61
DIR parent 2b573a81095ac0b57379389336a469a671ec10d7
HTML Author: parazyd <parazyd@dyne.org>
Date: Wed, 8 Nov 2017 16:58:28 +0100
ttidier stdout for logging
Diffstat:
M amprolla_merge.py | 2 +-
M lib/log.py | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
---
DIR diff --git a/amprolla_merge.py b/amprolla_merge.py
t@@ -117,7 +117,7 @@ def gen_release(suite):
"""
filelist = []
- print('Crawling %s' % suite)
+ print('\nCrawling %s' % suite)
rootdir = join(mergedir, mergesubdir, suite)
for cat in categories:
for arch in arches:
DIR diff --git a/lib/log.py b/lib/log.py
t@@ -5,7 +5,7 @@ Logging functions
"""
from time import time
-from os import makedirs, remove
+from os import makedirs
from os.path import join
import sys
t@@ -16,10 +16,10 @@ def die(msg, tofile=True):
"""
Log error and exit with exitcode 1
"""
- msg = "%d [ERR] %s\n" % (int(time()), msg)
+ msg = "%d [ERR] %s" % (int(time()), msg)
print(msg)
if tofile:
- logtofile('amprolla.txt', msg)
+ logtofile('amprolla.txt', msg+'\n')
sys.exit(1)
t@@ -27,20 +27,20 @@ def warn(msg, tofile=True):
"""
Log warning and continue
"""
- msg = "%d [WARN] %s\n" % (int(time()), msg)
+ msg = "%d [WARN] %s" % (int(time()), msg)
print(msg)
if tofile:
- logtofile('amprolla.txt', msg)
+ logtofile('amprolla.txt', msg+'\n')
def info(msg, tofile=True):
"""
Log informational message and continue
"""
- msg = "%d [INFO] %s\n" % (int(time()), msg)
+ msg = "%d [INFO] %s" % (int(time()), msg)
print(msg)
if tofile:
- logtofile('amprolla.txt', msg)
+ logtofile('amprolla.txt', msg+'\n')
def logtofile(filename, text, redo=False):