How to print only log messages for this registrar?

I am currently doing this in my code:

logger = logging.getLogger(__name__)
logger.info("something happened")

Then at the top of my main scripts, I do this:

logging.basicConfig(level=logging.INFO)

The problem is that there are too many messages. Is there a way to limit it to one or more different registrars?

+5
source share
1 answer

You can manage individual registrars by name. (In your example, you used a name that will be the name of the module, so each registrar will have a different name, the module modulo). You can use the log configuration file to control the logging level of each logger separately. Take a look at PEP: http://www.python.org/dev/peps/pep-0282/

+2
source

All Articles