Javi Torre
Javi Torre

Reputation: 824

Ignore logging for some modules

I have the following code:

from exhausted import main as main_exhausted

import logging

# Configure the log file
logging.basicConfig(
    filename="log/myprocess.log",
    level=logging.DEBUG
)

if __name__ == '__main__':
    main_exhausted()

However, the log is including entries from the paramiko library, which is used in the exhausted module. What would be the way to allow logs created by the exhausted module but not paramiko?

Upvotes: 0

Views: 138

Answers (1)

Vinay Sajip
Vinay Sajip

Reputation: 99520

You should be able to turn off Paramiko logging completely using for example

logging.getLogger('paramiko').setLevel(logging.CRITICAL + 1)

or use a different level such as ERROR, depending on if you want to allow e.g. ERROR and CRITICAL messages through from Paramiko.

Upvotes: 1

Related Questions