Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed /system_status logging #567

Merged
merged 19 commits into from
Jun 29, 2023
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Fixed:
^^^^^^
- Heatmap values to be converted from N to µN before sending to FE.

Changed:
^^^^^^^^
- Limited logging of /system_status to only when status code is not 200
NikitaPoly marked this conversation as resolved.
Show resolved Hide resolved


1.1.3 (2023-06-07)
------------------
Expand Down
10 changes: 10 additions & 0 deletions src/mantarray_desktop_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ def _log_system_info() -> None:
logger.info(msg)


class Filter_System_Status_Logs(logging.Filter):
tannermpeterson marked this conversation as resolved.
Show resolved Hide resolved
def filter(self: Filter_System_Status_Logs, record: logging.LogRecord) -> bool:
# log system_status only if not 200
message = record.getMessage()
return not ("system_status" in message and " 200 " in message)
NikitaPoly marked this conversation as resolved.
Show resolved Hide resolved


def main(command_line_args: List[str], object_access_for_testing: Optional[Dict[str, Any]] = None) -> None:
"""Parse command line arguments and run."""
if object_access_for_testing is None:
Expand All @@ -138,6 +145,9 @@ def main(command_line_args: List[str], object_access_for_testing: Optional[Dict[
# Tanner (5/20/22): not sure if this is actually logging anything since logging isn't configured yet
logger.info(command_line_args)

# add filtering of /system_status logs
logger.addFilter(Filter_System_Status_Logs())
NikitaPoly marked this conversation as resolved.
Show resolved Hide resolved

log_level = logging.INFO
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down