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
# Subclass fbchat.Client and override required methods
class EchoBot(Client):
@@ -6,7 +6,7 @@ class EchoBot(Client):
self.markAsDelivered(thread_id, message_object.uid)
self.markAsRead(thread_id)
log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name))
print("{} from {} in {}".format(message_object, thread_id, thread_type.name))
# If you're not the author, echo
if author_id != self.uid: