Skip to content

Instantly share code, notes, and snippets.

@yiidtw
Created December 19, 2018 11:00
Show Gist options
  • Save yiidtw/efc5b53c37829d7bf04cde6d09734cc6 to your computer and use it in GitHub Desktop.
Save yiidtw/efc5b53c37829d7bf04cde6d09734cc6 to your computer and use it in GitHub Desktop.
Simple log function for python 3
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