I have a python package and the logging level is set as below (in app.py).
logger = logging.getLogger('app')
logger.handlers = []
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.ERROR)
logging.getLogger("requests").setLevel(logging.WARNING)
I generally import this module DbApp (from app.py) and directly run it. As this package is installed using pip, I don't want to change the logging level in the file.
How can I change from my main program to set the logging level?
from db.rest import DbApp
app = DbApp()