Skip to content

Instantly share code, notes, and snippets.

@toby-p
Created October 29, 2018 15:30
Show Gist options
  • Save toby-p/3a9b6ab929cc1ee217c7abe75646bf44 to your computer and use it in GitHub Desktop.
Save toby-p/3a9b6ab929cc1ee217c7abe75646bf44 to your computer and use it in GitHub Desktop.
Simple debug print statements
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