I have created a logging module in my python package, and I am using the logging module to get the console logging instance for other files in the package. Now I want to create a toggle variable so that, I can disable or enable the console logging in the entire package. Please suggest me way to implement what i have described.
My sample package structure:
package/
|_ __init__.py
|_ logger.py
|_ moduleA.py
|_ moduleB.py
logger.py
import logging
""" can I create any get/set kind of implementation here to control a toggle variable 
    based on which I decide the log level to be DEBUG or ERROR for the entire package  """ 
def getLogger(name):
    logger = logging.getLogger(name)
    handler = logging.StreamHandler()
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)
    return logger
I am using this logger something like below in other modules
log = logger.getLogger(__name__)
log.info("Hello!")