robotika / osgar

Open Source Garden (Autonomous) Robot
MIT License
13 stars 12 forks source link

osgar/drivers/pcan.py - change log level from debug to info #982

Closed m3d closed 6 months ago

m3d commented 6 months ago

Python CAN has by default (to my surprise) log level "debug" (!), which is basically impossible to use once the communication is running (the CAN messages are printed). This one-liner allows change in config + sets as default "info". For more info see: https://python-can.readthedocs.io/en/v4.3.1/internal-api.html#can.util.set_logging_level

can.util.set_logging_level(level_name)[source]

Set the logging level for the “can” logger.

Parameters:

    level_name ([str](https://docs.python.org/3/library/stdtypes.html#str)) – One of: ‘critical’, ‘error’, ‘warning’, ‘info’, ‘debug’, ‘subdebug’, or the value [None](https://docs.python.org/3/library/constants.html#None) (=default). Defaults to ‘debug’.
Return type:

    None