Skip to content

Commit

Permalink
feat: filter nbdkit logs as verbose with a keyword list
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
  • Loading branch information
Millefeuille42 committed Feb 18, 2025
1 parent a730a95 commit ac72e87
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nbd_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,17 @@ def clean_paths():

# Continue to log server messages in stdout.
def log_server_messages():
verbose_keywords = [
'pread',
'pwrite'
]
while server.poll() is None:
line = server.stdout.readline().rstrip('\n')
if line:
thread_print(line)
if any(keyword in line for keyword in verbose_keywords):
dprint(line)
else:
thread_print(line)

server_stdout_thread = threading.Thread(target=log_server_messages)
server_stdout_thread.start()
Expand Down

0 comments on commit ac72e87

Please sign in to comment.