import logging logging.basicConfig(filename='codelogging.log', level=logging.DEBUG, format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S') a_variable = 200 # for loop with logging for i in range(100): x = print(i) logging.info('Iteriating') logging.info('Script completed')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter