1

I'm using this library only for couple methods, and it's kinda annoying that it's printing a lot of logs beside my own initialization logs.

Tried to get same logger as library gets, "pyrogram.client", and change it's level - nothing changed. Also logger.propagate = false doesn't help.

My friend got no logs from pyrogram by default, though our logger and pyrogram configs are the same.

2 Answers2

0

Try this:

import logging
logging.basicConfig(level=logging.WARNING)

You can also set the level to INFO, but that's up to you. Here are all the default levels: https://docs.python.org/3/library/logging.html#logging-levels

dieserniko
  • 121
  • 7
0

A way to go, if you do not want to suppress other loggers:

import logging
for name, logger in logging.root.manager.loggerDict.items():
    if name.startswith('pyrogram'):
        logger.setLevel(logging.WARNING)

Optionally, if that's not enough, replace WARNING with ERROR or CRITICAL.