Skip to content

Instantly share code, notes, and snippets.

@zhangzhhz
Last active December 29, 2019 08:36
Show Gist options
  • Save zhangzhhz/f31ce5f34404f9a4c570680b81b0b24c to your computer and use it in GitHub Desktop.
Save zhangzhhz/f31ce5f34404f9a4c570680b81b0b24c to your computer and use it in GitHub Desktop.
Using python logging module, one can change logging level of a imported module that also uses python logging. In this snippet, the last line (commented out) disables MSAL DEBUG logs.
import msal
# Optional logging
formatter = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
# logging.basicConfig(format=formatter, level=logging.DEBUG) # Enable DEBUG log for entire script
logging.basicConfig(format=formatter) # initialte logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# logging.getLogger("msal").setLevel(logging.INFO) # Optionally disable MSAL DEBUG logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment