Change loglevel in Olympe 1.2.1

Hello dear devs,

I used to love the way we could change the loglevel of Olympe with the

with olympe.Drone(“IP_addr”, loglevel=x) as drone:

As this is not available anymore, what is the new way of changing the log level in Olympe 1.2.1 ?

Thank you for all the good work !
Théotime

1 Like

Hello Théotime,

Olympe now uses the Python standard logging module and the old “loglevel” Drone constructor parameter is forever gone.
https://docs.python.org/3/library/logging.html
https://docs.python.org/3/library/logging.config.html

Under the hood, Olympe now uses the logging.config.dictConfig to configure the logs and because Olympe has to perform additional operations to handle ulog log messages properly (ulog is the Olympe/GroundSDK C side of the street for logs), the recommended way to configure your logs is to use the olympe.log.update_config function.

Example:

olympe.log.update_config({"loggers": {"olympe": {"level": "WARNING"}}})

If you need more advanced logging configuration options, a more complete example is available here:

Please let me know if that works for you. Thanks

Nicolas

2 Likes

Thank you so much for the quick and clear response !
I think this change is a good thing for Olympe !
Have a nice day

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.