feat: added timestamp to information widget log items

This commit is contained in:
Ignacio Muñoz Fernandez
2020-11-26 22:55:53 +01:00
committed by Dan Albert
parent 28cf42aeb8
commit 3ad57d995b
2 changed files with 9 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import datetime
class Information():
@@ -5,7 +6,12 @@ class Information():
self.title = title
self.text = text
self.turn = turn
self.timestamp = datetime.datetime.now()
def __str__(self):
s = "[" + str(self.turn) + "] " + self.title + "\n" + self.text
return s
return '[{}][{}] {} {}'.format(
self.timestamp.strftime("%Y-%m-%d %H:%M:%S") if self.timestamp is not None else '',
self.turn,
self.title,
self.text
)