Created
December 19, 2018 11:00
-
-
Save yiidtw/efc5b53c37829d7bf04cde6d09734cc6 to your computer and use it in GitHub Desktop.
Simple log function for python 3
This file contains 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
from datetime import datetime | |
def logit(msg, log_type="INFO"): | |
try: | |
print(' {} {} {}'.format(log_type, datetime.now().strftime("%Y-%m-%d %H:%M:%S"), msg)) | |
except Exception as e: | |
print(' ERROR logging' + e.message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment