question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Is there a way to make all the logs go to one file that I designate?

See original GitHub issue

Question in title. I essentially want to log all the on_.... commands, mostly the on_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 😢

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
madsmtmcommented, Jan 29, 2020

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 😉

0reactions
madsmtmcommented, Feb 5, 2020

I’ve made the issue asking for feedback, #526, kindly submit your thoughts! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I make a Makefile to log both command and its output ...
It is a default behaviour of make to print both the command and its output to stdout. An obvious solution is to just...
Read more >
Chapter 23. Viewing and Managing Log Files
Log files are files that contain messages about the system, including the kernel, services, and applications running on it. There are different log...
Read more >
Creating a “Log” File in Stata - Harvard Sociology
Navigate to the folder where you want to save your log file, enter the file name, and specify whether you want to save...
Read more >
Managing IIS Log File Storage - Microsoft Learn
Open Server Manager, click the Tools menu, and then click Task Scheduler. · In the Actions pane of the Task Scheduler dialog box,...
Read more >
Linux Log Files Location And How Do I View Logs ... - nixCraft
Explains how to view log file location and search log files in Linux for common services such as mail, proxy, web server using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found