import datetime class LogList(): def __init__(self): self.log_list = list() def add_item(self,*args): args = [str(i) for i in args] item = " ".join(args) item = str(datetime.datetime.now())+" , "+str(item) self.log_list.append(item) if len(self.log_list) > 100: self.log_list.pop(0) def get_log_list(self): return self.log_list _log_handler = None def get_log_handler(): global _log_handler if not _log_handler: _log_handler = LogList() return _log_handler