Black_Rabbit

LoggableList

Nov 14th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import time
  2.  
  3.  
  4. class Loggable:
  5.     def log(self, msg):
  6.         print(str(time.ctime()) + ": " + str(msg))
  7.  
  8.  
  9. class LoggableList(list, Loggable):
  10.     def append(self, count):
  11.         x = super(LoggableList, self).append(count)
  12.         self.log(count)
  13.         return x
Add Comment
Please, Sign In to add comment