Skip to content

Commit

Permalink
Support for reverse on messages print
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 5, 2020
1 parent 2c5e453 commit 2fcc309
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/quorum/log.py
Expand Up @@ -204,9 +204,17 @@ def get_latest(self, count = None, level = None):
slice = itertools.islice(messages, 0, count)
return list(slice)

def flush_to_file(self, path, count = None, level = None, clear = True):
def flush_to_file(
self,
path,
count = None,
level = None,
reverse = True,
clear = True
):
messages = self.get_latest(level = level, count = count or 65536)
if not messages: return
if reverse: messages.reverse()
file = open(path, "wb")
try:
for message in messages:
Expand Down

0 comments on commit 2fcc309

Please sign in to comment.