Disabling logger in Flask Socket.io

前端 未结 1 1645
死守一世寂寞
死守一世寂寞 2021-01-19 04:19

I have an application using Flask and FlaskSocket.IO 2.8.4. When I initialise SocketIO, I am using

#[...]

logging.basicConfig(level=logging.DEBUG,format=\'         


        
相关标签:
1条回答
  • 2021-01-19 04:57

    The reason the logging changes you are applying don't work is that the global changes you've applied via logging.basicConfig take precedence.

    Here is how you can override those defaults, just for the Socket.IO logger:

    logging.getLogger('socketio').setLevel(logging.ERROR)
    logging.getLogger('engineio').setLevel(logging.ERROR)
    

    This will set both packages to log only errors.

    0 讨论(0)
提交回复
热议问题