1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/python import sys,time class log(): def timestamp(self): return time.strftime('%a %D %H:%M:%S ') def __init__(self,logname): self.logname=logname self.log("log started") def log(self,entry): f=open(self.logname,"a") f.write(self.timestamp()+entry+'\n') f.close()