Add offset for log partial

This commit is contained in:
Ruud
2014-05-08 16:59:41 +02:00
parent 66b4821f7f
commit df14032107
+5 -2
View File
@@ -88,9 +88,10 @@ class Logging(Plugin):
'total': total, 'total': total,
} }
def partial(self, type = 'all', lines = 30, **kwargs): def partial(self, type = 'all', lines = 30, offset = 0, **kwargs):
total_lines = tryInt(lines) total_lines = tryInt(lines)
offset = tryInt(offset)
log_lines = [] log_lines = []
@@ -113,14 +114,16 @@ class Logging(Plugin):
if type == 'all' or line.get('type') == type.upper(): if type == 'all' or line.get('type') == type.upper():
log_lines.append(line) log_lines.append(line)
if len(log_lines) >= total_lines: if len(log_lines) >= (total_lines + offset):
brk = True brk = True
break break
if brk: if brk:
break break
log_lines = log_lines[offset:]
log_lines.reverse() log_lines.reverse()
return { return {
'success': True, 'success': True,
'log': log_lines, 'log': log_lines,