|
@@ -129,10 +129,19 @@ class LogList(LineList):
|
|
|
def __init__(self, window, colors):
|
|
|
self.line_list = LineList(window)
|
|
|
self.c = colors
|
|
|
+ self.log_file = open('cockpit.log', 'a')
|
|
|
|
|
|
def _log_time(self, s, attr):
|
|
|
timestamp = datetime.datetime.now().strftime('%H:%M:%S')
|
|
|
- self.line_list.add_line('[{}] {}'.format(timestamp, s), attr)
|
|
|
+ log = '[{}] {}'.format(timestamp, s)
|
|
|
+ self.line_list.add_line(log, attr)
|
|
|
+ self.log_file.write(log)
|
|
|
+
|
|
|
+ if not log.endswith('\n'):
|
|
|
+ self.log_file.write('\n')
|
|
|
+
|
|
|
+ self.log_file.flush()
|
|
|
+ os.fsync(self.log_file.fileno())
|
|
|
|
|
|
def info(self, s):
|
|
|
self._log_time(s, self.c.get(Colors.NORMAL))
|