Prefix logs with embedded newlines with time/type header

This commit is contained in:
moneromooo 2014-12-24 18:49:05 +00:00
parent 244b11db7d
commit e092188f80
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ last_ping_time = time.time()
def log(stype,msg):
print '%s\t%s\t%s' % (time.ctime(time.time()),stype,str(msg))
header = "%s\t%s\t" % (time.ctime(time.time()),stype)
print "%s%s" % (header, str(msg).replace("\n","\n"+header))
def log_error(msg):
log("ERROR",msg)