Handle print() messages when not frozen and in debug. We only want to exclude handling stacktraces, so the IDE gets clickable line numbers.

This commit is contained in:
Ebag333
2017-02-11 11:59:49 -08:00
parent 3b185e1bcb
commit 441b3f1646

14
pyfa.py
View File

@@ -232,17 +232,19 @@ if __name__ == "__main__":
with logging_setup.threadbound():
# Don't redirect if frozen
if not hasattr(sys, 'frozen') and not options.debug:
if not hasattr(sys, 'frozen'):
# Output all stdout (print) messages as warnings
try:
sys.stdout = LoggerWriter(pyfalog.warning)
except ValueError, Exception:
pyfalog.critical("Cannot access log file. Continuing without writing stdout to log.")
# Output all stderr (stacktrace) messages as critical
try:
sys.stderr = LoggerWriter(pyfalog.critical)
except ValueError, Exception:
pyfalog.critical("Cannot access log file. Continuing without writing stderr to log.")
if not options.debug:
# Output all stderr (stacktrace) messages as critical
try:
sys.stderr = LoggerWriter(pyfalog.critical)
except ValueError, Exception:
pyfalog.critical("Cannot access log file. Continuing without writing stderr to log.")
pyfalog.info("Starting Pyfa")
pyfalog.info("Running in logging mode: {0}", logging_mode)