Created
December 19, 2017 05:01
-
-
Save redstoneleo/7fdde40a084eb8573b5f4e1e57b887c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits go to the Qt Centre forum. | |
# import logging | |
# import sys | |
# logging.basicConfig(filename='LYYDownloader.log') | |
# def uncaughtExceptionHandler(type_, value, traceback): | |
# print(type_, value, traceback) | |
# logging.error("Uncaught exception", exc_info=(type_, value, traceback)) | |
# # sys.exit(1)#depend on whether you want to terminate your program | |
# sys.excepthook = uncaughtExceptionHandler | |
# if __name__ == "__main__": | |
# logging.info('I told you so') # will not print anything | |
# logging.warning('Watch out!') # will print a message to the console | |
# 1/0 | |
# why logging.info('I told you so') won't be logged ? see https://docs.python.org/3.6/howto/logging.html#a-simple-example | |
# want to restrict your log file size ? see | |
# want to set '\n\n' as the terminator when writing a formatted LogRecord to a stream | |
import logging | |
import logging.handlers | |
http = logging.handlers.HTTPHandler('112.74.98.187:1071', '/VideoParser/lYYDownloaderClientLog/') | |
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d %I:%M:%S %p', handlers=[http]) | |
logging.error('yahoo Server Exception') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment