-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add console handler for logging #337
Comments
We could also use loguru or fancylog to reduce the amount of logging configuration we have to do on our side. If we go with |
naive question: is it a matter of adding a import logging
logging.getLogger().setLevel(logging.INFO) ? EDIT: we confirm this was indeed naive 😬 I had in my notes that this logging tutorial was useful so linking here in case it helps |
Todays discussions with @sfmig about logging made me look into this issue again, and I think this may be a one-line-ish fix. The problem is that the It should be changed to sth like this: def log_warning(message: str, logger_name: str = "movement"):
"""Log a warning message and emit a UserWarning.
Parameters
----------
message : str
The warning message.
logger_name : str, optional
The name of the logger to use. Defaults to "movement".
"""
logger = logging.getLogger(logger_name)
logger.warning(message)
warnings.warn(message, UserWarning, stacklevel=2) |
I've started attempting a fix in #412 I think it works, based on the fact that warning messages that we were missing before started appearing now.
The absence of this message was what made us notice the problem in the first place, right @sfmig? If I'm right #412 is sufficient to close this issue. The problem now is that tests now emit >100 warnings, because of all the times they hit a |
No that's unrelated I think. The warnings are emitted because of the |
Our current logging configuration only adds a rotating file handler, and does not configure a console handler. This means:
What we would actually want:
To achieve this behaviour, we need to add a console handler to our logger and set the appropriate log levels for both handlers.
The text was updated successfully, but these errors were encountered: