fbchat-dev / fbchat

Facebook Chat (Messenger) for Python
https://fbchat.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.19k stars 412 forks source link

Logging level is ignored. #229

Closed truenicoco closed 4 years ago

truenicoco commented 7 years ago

When subclassing fbchat.Client, no matter which logging_level is passed, the standard output displays messages at the DEBUG level.

madsmtm commented 7 years ago

fbchat's logging setup is kind of wierd, and I must admit, I don't fully understand it, but maybe you could try to provide some code that should be working, and isn't?

truenicoco commented 7 years ago

Unfortunately right now I've stopped using fbchat and moved to a XMPP prosody/spectrum/libpurple-facebook solution for my needs.

Here's what my code looked like anyway: https://bitbucket.org/nicocool84/fb_bot/raw/447c246b2b991cf99477a06797365a1252c15414/fb_bot.py

madsmtm commented 7 years ago

I'm sorry was so late at answering, and that I couldn't help you. This is definitely one of the things getting reworked next in the next major release. Good luck with your project anyways ;)

EDIT: I would guess the "solution" would be to include this:

from fbchat import log
log.setLevel(logging_level)

Though this is untested!

lobstr commented 6 years ago

If you pass it as a numeric value it behaves correctly. See: Logging Levels

madsmtm commented 6 years ago

I will address this further in an upcoming update, seems like the logging system we use is directly in-advised: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

madsmtm commented 4 years ago

Fixed a while ago in d3a0ffc47802f6593ff8871795f53cf21bda714e, not yet released