This module contains a logger, which monitors stdout and stderr and stores the information written to it into a temporary file. The Logger uses should be used with python’s with statement. You can write:
from pyvhist.logger import Logger
from pyvhist.tempdir import TempDir
logfile = "output.log"
with Logger(logfile, tempDir) as log:
doStuff()
addFileToVhistSection(log.filename)
You can use the property filename after your code left the with-block to access the filename of the temporary file, which contains the log output.