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:
# -*- coding: UTF-8 -*-
import olympe
import time
from olympe.messages.ardrone3.Piloting import TakeOff, Landing
olympe.log.update_config({
"handlers": {
"olympe_log_file": {
"class": "logging.FileHandler",
"formatter": "default_formatter",
"filename": "olympe.log"
},
"ulog_log_file": {
"class": "logging.FileHandler",
"formatter": "default_formatter",
"filename": "ulog.log"
},
},
"loggers": {
This file has been truncated. show original
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
system
Closed
June 22, 2020, 3:38pm
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.