Search code examples
pythonloggingpyrogram

Is there a way to disable Pyrogram logging?


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.


Solution

  • 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