I wanted to add some logging to colored print statements. The naive approach was to create a function
def log_and_print(msg,level='info',color="", reset=""):
if level == 'info':
logging.info(msg)
elif level == 'debug':
logging.debug(msg)
print(color+str(msg)+reset)
It works fine, but discovered that of course the path that is being logged isn't correct anymore. Is there some better solution? I hoped to be able to keep the log_and_print function, since it is used in a lot of places.