summaryrefslogtreecommitdiffstats
path: root/bwLpStatus.py
diff options
context:
space:
mode:
Diffstat (limited to 'bwLpStatus.py')
-rwxr-xr-xbwLpStatus.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/bwLpStatus.py b/bwLpStatus.py
index 882ec1f..59f37b8 100755
--- a/bwLpStatus.py
+++ b/bwLpStatus.py
@@ -131,7 +131,7 @@ def thrift(name, ip, port, server):
elif server == 'MASTER':
masterserver = make_client(bwlp_thrift.MasterServer, ip, port, trans_factory=TFramedTransportFactory())
organisations = masterserver.getOrganizations()
- print(organisations)
+
organisationList = []
for org in organisations:
organisationList.append(Organisation(org.organizationId, org.displayName))
@@ -149,6 +149,7 @@ def thrift(name, ip, port, server):
# Parses the log from the logfile. Fills the logEntries array.
def parseLog():
+ global logEntries
if not (os.path.exists('bwLpStatusLog.txt')):
return
with open('bwLpStatusLog.txt', 'r') as log:
@@ -157,6 +158,7 @@ def parseLog():
entry = line.split('\t')
if len(entry) < 4: continue
logEntries.append(LogEntry(entry[0], entry[1], entry[2], entry[3], '' if len(entry) < 5 else entry[4], [] if len(entry) < 6 else entry[5]))
+
global newLogIndex
newLogIndex = len(logEntries)
@@ -243,7 +245,13 @@ for status in statusList:
# Generate the html code for the log.
log = '\r\n'
-for entry in reversed(logEntries):
+
+# Cut the log to the last n entries
+n = 500
+cut_amount = 0
+if len(logEntries) >= n:
+ cut_amount = len(logEntries) - n
+for entry in reversed(logEntries[cut_amount:]):
log += ('<div class="log_item"><div class="log_item_part time"><div class="content_item_part_title">['
+ entry.date + ']</div></div><div class="log_item_part service"><div class="content_item_part_title">['
+ entry.service + ']</div></div><div class="log_item_part '