Open
Description
To reproduce (based on getting_started/asyncio/driving/drive_raw_motors.py
):
import asyncio
import logging
from sphero_sdk import SpheroRvrAsync
from sphero_sdk import SerialAsyncDal
from sphero_sdk import RawMotorModesEnum
# setup and test logging
logging.getLogger().setLevel(logging.INFO)
logging.info("Now the default logging works")
loop = asyncio.get_event_loop()
rvr = SpheroRvrAsync(
dal=SerialAsyncDal(
loop
)
)
logging.info("Now it does not")
This result is probably not intended, because it makes integration with existing projects more complicated.
The behavior is caused by logging_config.py's 'null_handler', so the workarounds are ether to set SpheroRvrAsync's
log_level to 2, which also cause other additional logs from the rover or to remove the 'null_handler' handler with
null_handler = [h for h in logging.getLogger().handlers if h.name == "null_handler"][0]
logging.getLogger().removeHandler(null_handler)
after the RVR has been initialized.
The proper solution would probably be to create and use a new named logger for the sdk, and block that when using
LogLevel.Silent
.
Metadata
Assignees
Labels
No labels