[Python] Python logging only log from script

Discussão em 'Python' iniciado por Stack, Novembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I'm using the Python logging module in a simple script of mine with the following setup at the moment.

    logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')
    logger = logging.getLogger(__name__)


    My problem is that this also catches 3rd party modules like requests and output info() log messages from them. Is there any way to suppress these messages or tell the logging module only to log messages from my own script?

    Continue reading...

Compartilhe esta Página