Skip to content
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

Guidance for Properly Logging #33

Open
j9ac9k opened this issue Aug 14, 2019 · 1 comment
Open

Guidance for Properly Logging #33

j9ac9k opened this issue Aug 14, 2019 · 1 comment

Comments

@j9ac9k
Copy link

j9ac9k commented Aug 14, 2019

It would be good if the tutorial provided some guidance on how to setup logging, especially for macOS, where the logger FileHandler only takes relative paths, and thus attempts to write in a read-only portion of the app bundle.

On Linux, the logging.handlers.FileHandler appeared to work fine (wrote to the user home directory if I remember right), I have not tested on Windows.

Thanks for the awesome package!

@mherrmann
Copy link
Owner

Thank you for the suggestion. I want to keep fbs's docs to the minimum, because the longer they get, the more difficult they become to read (by fbs users like yourself), and to maintain for me. I feel like the logging questions you describe are beyond the scope of fbs's documentation, as this isn't strictly a feature of fbs.

Having said that, I don't think FileHandler only takes relative paths. Without having tested it, I think you should be able to log to the home directory with the following code on all OSs:

from os import makedirs
from os.path import expanduser
from logging import FileHandler
makedirs(expanduser('~/.myapp'), exist_ok=True)
handler = FileHandler(expanduser('~/.myapp/myapp.log'))

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants