-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: persist application logs #242
Conversation
- on Mac: `~/Library/Logs/k6 Studio/k6-studio.log` | ||
- on Windows: `%USERPROFILE%\AppData\Roaming\k6 Studio\logs\k6-studio.log` | ||
|
||
When opening an issue, please include a tail of your log file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add a section in the bug template asking for this 🤔
src/logger.ts
Outdated
log.initialize() | ||
|
||
// log electron core events | ||
// @see https://github.com/megahertz/electron-log/blob/master/docs/events.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: I think the @see
are redundant and probably the link alone would suffice 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@see
is part of JSDoc. I believe it wouldn't be applicable for this context, so I'll remove it!
src/main.ts
Outdated
@@ -505,6 +511,11 @@ ipcMain.handle('browser:open:external:link', (_, url: string) => { | |||
shell.openExternal(url) | |||
}) | |||
|
|||
ipcMain.handle('application:open-log', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor suggestion: should we shorten it with app:open-log
?
I'm not sure about this
caa8ac7
to
52a3714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw exceptions in specific parts of the app and raise them from the UI
Should it catch UI exceptions automatically? I've tried adding throw new Error('test')
to Home.tsx
but it wasn't logged.
If I misunderstood, and it wasn't supposed to catch UI exceptions, could we wrap App in error boundary to implement this?
That was missing since I forgot to initialize the error handler in the UI, good catch! Now it should be logging those to the disk as well! The error boundary is something we're missing and would be a nice addition but since we have everything logged to disk at this point, I'll leave the error boundary for a follow-up PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
Description
This PR introduces changes needed to capture caught and uncaught exceptions to a log file. This will enable us to troubleshoot issues more efficiently.
Here's an example of a log file being generated by the Studio. This includes errors raised by the proxy, IpcMain call and unhandle exceptions.
In addition, a button was included in the UI to allow users to retrieve the log file more easily.
How to Test
Checklist
npm run lint
) and all checks pass.npm test
) and all tests pass.Screenshots (if appropriate):
Related PR(s)/Issue(s)
Resolves #235