Created
October 29, 2018 15:30
-
-
Save toby-p/3a9b6ab929cc1ee217c7abe75646bf44 to your computer and use it in GitHub Desktop.
Simple debug print statements
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
from datetime import datetime | |
import pytz | |
def debug_print(msg, timezone="US/Eastern"): | |
"""Print a time-stamped debug message.""" | |
UTC_now = pytz.utc.localize(datetime.utcnow()) | |
now = UTC_now.astimezone(pytz.timezone(timezone)) | |
now_date = now.strftime("%Y_%m_%d") | |
now_time = now.strftime("%H:%M:%S") | |
print("[{} @ {}] : {}".format(now_date, now_time, msg)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment