Aside from the print statements and wandb output, it might be nice for development and debugging to have the option to turn on verbose debug logs.
I've used something like below in the past. Put that in a root level __init__.py file and then in every other file you just import logging; logger = logging.getLogger(__name__); logger.debug(f'foobar')
import logging
import logging.config
LOG_FORMAT = "%(asctime)s %(pathname)s %(lineno)s {}".format(logging.BASIC_FORMAT)
log_level = getattr(logging, os.environ.get('PY_LOG_LVL', 'WARNING').upper())
logging_config = {
'version': 1,
'formatters': {
'standard': {
'format': LOG_FORMAT,
},
},
'handlers': {
'default': {
'level': log_level,
'formatter': 'standard',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'': {
'handlers': ['default'],
'level': log_level,
'propagate': True,
},
},
}
logging.config.dictConfig(logging_config)
Aside from the print statements and wandb output, it might be nice for development and debugging to have the option to turn on verbose debug logs.
I've used something like below in the past. Put that in a root level
__init__.pyfile and then in every other file you justimport logging; logger = logging.getLogger(__name__); logger.debug(f'foobar')