Created
March 29, 2012 22:11
-
-
Save solomon081/2244264 to your computer and use it in GitHub Desktop.
DateTime Error Log
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
def logtime(message, logfile): | |
"""Writes a message to a log file, as well as the time""" | |
log = open(logfile, 'a') | |
log.write("Error at:") | |
log.write(str(datetime.datetime.now())) | |
log.write(message) | |
def relog(message, logfile): | |
"""Overwrites the log file and writes a message to the log file, as well as the time""" | |
log = open(logfile, 'w') | |
log.write(str(datetime.datetime.now())) | |
log.write(message) | |
def readlog(message, logfile): | |
"""Reads the log file""" | |
log = open(logfile, 'r') | |
log.readlines() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment