Log_handler.py 411 B

12345678910111213141516
  1. import datetime
  2. class log_list():
  3. def __init__(self):
  4. self.log_list = list()
  5. def add_item(self,*args):
  6. args = [str(i) for i in args]
  7. item = " ".join(args)
  8. item = str(datetime.datetime.now())+" , "+str(item)
  9. self.log_list.append(item)
  10. if len(self.log_list) > 100:
  11. self.log_list.pop(0)
  12. def get_log_list(self):
  13. return self.log_list