Fix logging

- Following advice here: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
- Renamed the logger: client -> fbchat
- Remove logging_level init parameter from Client
- Use print instead of log.info in examples
This commit is contained in:
Mads Marquart
2019-08-28 22:27:29 +02:00
parent d84ad487ee
commit d3a0ffc478
10 changed files with 30 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
from fbchat import log, Client
from fbchat import Client
from fbchat.models import *
@@ -6,7 +6,7 @@ class RemoveBot(Client):
def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
# We can only kick people from group chats, so no need to try if it's a user chat
if message_object.text == "Remove me!" and thread_type == ThreadType.GROUP:
log.info("{} will be removed from {}".format(author_id, thread_id))
print("{} will be removed from {}".format(author_id, thread_id))
self.removeUserFromGroup(author_id, thread_id=thread_id)
else:
# Sends the data to the inherited onMessage, so that we can still see when a message is recieved