Skip to content

Commit

Permalink
don't redraw status bar for every log field
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck committed Jun 23, 2021
1 parent c6aa470 commit 300bb1d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1447,15 +1447,19 @@ proc initStatusBar(node: BeaconNode) {.raises: [Defect, ValueError].} =
when compiles(defaultChroniclesStream.output.writer):
defaultChroniclesStream.output.writer =
proc (logLevel: LogLevel, msg: LogOutputStr) {.raises: [Defect].} =
try:
# p.hidePrompt
erase statusBar
# p.writeLine msg
stdout.write msg
render statusBar
# p.showPrompt
except Exception as e: # render raises Exception
logLoggingFailure(cstring(msg), e)
if msg.len > 0:
try:
if msg[^1] == '\n':
# p.hidePrompt
erase statusBar
# p.writeLine msg
stdout.write msg
render statusBar
# p.showPrompt
else:
stdout.write msg
except Exception as e: # render raises Exception
logLoggingFailure(cstring(msg), e)

proc statusBarUpdatesPollingLoop() {.async.} =
try:
Expand Down

0 comments on commit 300bb1d

Please sign in to comment.