Files
DistMaker/script/logUtils.py
Norberto Lopez 3a286b7087 Code cleanup.
Fixed application argument processing.
Fixed memory configuration logic under Linux.
Improved scripts to make them more robust.
2016-03-08 20:28:40 +00:00

25 lines
631 B
Python

import hashlib
import os
import time
import sys
def appendLogOutputWithText(aStr, aText):
""" Method which given a string from a log will insert all occurances of newlines with the
specified text. Note if the last character is a newline then it will be stripped before the replacement"""
if aStr.endswith("\n") == True:
aStr = aStr[:-1]
retStr = aText + aStr.replace('\n', '\n' + aText)
return retStr;
def log(aStr, tabReplace=None):
""" Method which will print aStr to the console and optionally replace all tab
characters with tabReplace"""
if tabReplace != None:
aStr.replace('\t', tabReplace)
print(aStr)