Skip to content

Commit

Permalink
Merge branch 'silence-warnings' into add-GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
0dm committed Jun 7, 2023
2 parents cc0107f + cf3b7ce commit 45a651f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions openadapt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"RECORD_READ_ACTIVE_ELEMENT_STATE": False,
# TODO: remove?
"REPLAY_STRIP_ELEMENT_STATE": True,
"IGNORE_WARNINGS": True,
}


Expand Down
15 changes: 11 additions & 4 deletions openadapt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import mss.base
import numpy as np

from openadapt import common
from openadapt import common, config


# TODO: move to config.py
Expand All @@ -28,12 +28,19 @@ def configure_logging(logger, log_level):
log_level_override = os.getenv("LOG_LEVEL")
log_level = log_level_override or log_level
logger.remove()
logger.add(sys.stderr, level=log_level, filter=good_filter)
logger.add(
sys.stderr,
level=log_level,
filter=filter_log_messages if config.IGNORE_WARNINGS else None,
)
logger.debug(f"{log_level=}")


def good_filter(data):
return not data["message"].endswith("Cannot pickle Objective-C objects')")
def filter_log_messages(data):
messages_to_ignore = [
"Cannot pickle Objective-C objects",
]
return not any(msg in data["message"] for msg in messages_to_ignore)


def row2dict(row, follow=True):
Expand Down

0 comments on commit 45a651f

Please sign in to comment.