Open Adina-Rahim opened 2 years ago
Danielle and I will replace all these statements. The limiting step is piping the output from lmfit into the logger, which will involve capturing the output of the print statements.
@AdinaRahim Are you able to give some details of what you tried with regards to logging and lmfit and what issues you found?
Lmfit uses print to write outputs to the command line. We will have to capture the output of the print statements and send them to the logger and back to sys.stdout.
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setLevel(logging.DEBUG)
file_handler = logging.FileHandler('new_log.log')
file_handler.setLevel(logging.DEBUG)
logger.addHandler(file_handler)
logger.addHandler(stdout_handler)
@daniellefenech @S-Hunt, I tried to set handler for both standard_output and file as depicted above. It's generating log file as well as keeping output on console. Made replacements only on settings.py
file.
This is really outside the scope of the initial project request for the GUI as it is an update to the core application so will be at the bottom of the backlog.
Capturing the stdout may well be possible. A quick Google gives this: https://stackoverflow.com/questions/5136611/capture-stdout-from-a-script