Merge branch 'log-lines' into 'v3'

Strip new lines when logging stitching

Closes #567

See merge request openflexure/openflexure-microscope-server!406
This commit is contained in:
Julian Stirling 2025-10-17 13:17:49 +00:00
commit 3d3ca9ebcf

View file

@ -300,7 +300,7 @@ class FinalStitcher(BaseStitcher):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
bufsize=1,
universal_newlines=True,
text=True,
)
# Stop opening pipe blocking writing to it
os.set_blocking(process.stdout.fileno(), False)
@ -344,5 +344,7 @@ class FinalStitcher(BaseStitcher):
def log_buffer(self, buffer: TextIOWrapper) -> None:
"""Log everything in the buffer at INFO level."""
# Use rstrip to remove newlines from each line, as logging provides its own
# new lines
while line := buffer.readline():
self.logger.info(line)
self.logger.info(line.rstrip())