From 353d311c1e83ae978e620896e023988056b3f9e0 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Wed, 27 Aug 2025 13:24:37 +0000 Subject: [PATCH] Apply suggestions from code review of branch no-uvicorn.error-logs-without-error Co-authored-by: Richard Bowman --- src/openflexure_microscope_server/logging.py | 4 +--- tests/test_logging.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/openflexure_microscope_server/logging.py b/src/openflexure_microscope_server/logging.py index 4710e1d4..69a03ffc 100644 --- a/src/openflexure_microscope_server/logging.py +++ b/src/openflexure_microscope_server/logging.py @@ -106,10 +106,8 @@ class OFMLogFileFormatter(logging.Formatter): def format(self, record: logging.LogRecord): """Adjust the logging formatting for uvicorn logs. - Any ``uvicorn.error`` logs that are at a lower - uvicorn has two loggers. Each API access is ``uvicorn.access`` which we filter - due to the noise the other is ``uvicorn.error`` for more important messages. + due to the noise. The other is ``uvicorn.error`` for more important messages. However, ``uvicorn.error`` is used for expected messages that are not errors, such as server start up. This can lead to people erroneously thinking that there is an error with their miroscope. diff --git a/tests/test_logging.py b/tests/test_logging.py index 01c38562..bdeec6d2 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -181,7 +181,7 @@ def test_uvicorn_error_only_says_error_on_error( ofm_logging.OFM_HANDLER = ofm_logging.OFMHandler() with tempfile.TemporaryDirectory() as tmpdir: ofm_logging.configure_logging(tmpdir) - log_command("Mockedy mock mock!") + log_command("Mockety mock mock!") with open(ofm_logging.OFM_LOG_FILE, "r", encoding="utf-8") as log_file: log_txt = log_file.read() for name in names_in_log: