-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Is there a way to make all the logs go to one file that I designate? #523
Comments
Hmm, the new version shouldn't be released yet, so it shouldn't be a problem; just use the version on PyPI / the |
Oh, and regarding your specific question, see the examples for how I've currently designed the listening system; under that design (which will change), you would do: import fbchat
session = fbchat.Session.login(...)
listener = fbchat.Listener.connect(session, True, True)
for event in listener.listen():
if isinstance(event, fbchat.MessageEvent):
with open('file.log', 'a') as f:
f.write(event.message.text) |
Thank you so much for the response! I've notices you get back the people super quickly and I appreciate that Oh ok, I see. I was looking at master by accident As for the listener in v2, is that where all the |
Yup, that's where I'll move it. Ideally, I'd like the following to work: import fbchat
session = fbchat.Session.login(...)
listener = fbchat.Listener(session, True, True)
@listener.register
def on_message(message: fbchat.Message):
with open('file.log', 'a') as f:
f.write(message.text)
listener.run() But I'm not quite there yet. I'll close this issue for now though, if you don't mind 😉 |
I've made the issue asking for feedback, #526, kindly submit your thoughts! 😃 |
Question in title. I essentially want to log all the
on_....
commands, mostly theon_message
, to a file. However I see the way to do this has changed. It is no longer making a subclass of Client so I will have to re learn this :'(The text was updated successfully, but these errors were encountered: