简体   繁体   中英

Log ALL errors without using python logging library

I am trying to make a python program that others on my team can use without me having to make a GUI. Thus, it is important that the code they interface is super simple and intuitive to the users. I don't want to put logging code in the main program because I think it would confuse them and I don't know what kind of errors they will produce in the main. Is there a way to route ALL errors and warnings (that would be default be printed to STOUT) to a log file without using python logging module ?

You may want to check this question: Capture stdout from a script in Python

[edit]removed the code snippept, because it is all there (sorry missed the python 3 examples there)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM