I have a function called Log that writes a log string to the robot framework log files. If I call this function from within A.py where its defined , it logs into the output.html as expected. But if i call this function from another python function init.py which in turn is invoked from A.py itself using subprocess.call, It does not log into output.html. It simply ignores it. A.py:
def Log( logString,typeOfLog):
ts = time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
print(st)
if typeOfLog=="INFO":
logger.console(st + ' ' + logString)
logger.info(logString)
elif typeOfLog=="DEBUG":
logger.console(st + ' ' + logString)
logger.debug(logString)
elif typeOfLog=="WARN":
logger.console(st + ' ' + logString)
logger.warn(logString)
elif typeOfLog=="ERROR":
logger.console(st + ' ' + logString)
logger.error(st + ' ' + logString)
elif typeOfLog=="":
logger.console(logString)
logger.trace(logString)
.
.
.
.
def Test():
Log("My debug statement in DEPLOY.PY","INFO")----->gets logged to output.html
ret = subprocess.call("python init.py", shell=True)
.
.
.
Code for init.py:
from A import Log
from robot.api import logger
def initfunc1():
Log("Something","INFO")------>this does not get logged to output.html
initfunc1()
IF someone can explain why this is happening and how to make the calls to Log function from init.py also to log into output.html as expected, it would be of great help to me.
Thanks in advance.