-
Notifications
You must be signed in to change notification settings - Fork 64
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
Implement cached logging capability #616
Implement cached logging capability #616
Conversation
Codecov Report
@@ Coverage Diff @@
## master #616 +/- ##
==========================================
- Coverage 67.80% 67.70% -0.11%
==========================================
Files 75 75
Lines 2196 2251 +55
Branches 202 207 +5
==========================================
+ Hits 1489 1524 +35
- Misses 664 683 +19
- Partials 43 44 +1
Continue to review full report at Codecov.
|
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! Just 1 discussion point
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.
I like the abstraction to a variable log count limit!
Have a few suggestions and also I think separate
was spelled wrongly 😆
Looks good otherwise!
Sorry, I need some clarification about the intended scope of this PR. In your PR summary:
But the log sample seems to show logs for several sessions (correct me if I'm wrong) -- are we keeping logs for multiple session or single session?
But this PR also adds a "Download Log" button that creates a log file --> is the PR summary out-of-date ? |
I tested the logging with a clean cache on Chrome.
I understand the However, should all the statements be logged under a single |
Was a little stumped on the method to fix this but the issue is caused by the OAuth Pop-up window. On redirection from the GH Authentication URL, it goes back to another instance of our application which the 'new' LoggingService triggers a second start session. Was initially looking into ways to prevent this redirection and have the pop-up close on successful authentication in the Pop-up window but found an easier way and that is to only let the
Which is caused by the fact that any logs printed in the pop-up window is saved to the log. I think this is ok but if need be I can modify the logging functions to check where they are logged from and attach some sort of identifier to the string for us to easily differentiate between the windows. Shall I do that? |
This seems OK in my view. The duplicate
No need, in my view, as the pop-up window's role is quite limited. |
Okay, sounds good 👍 |
Thanks for the work on this @ptvrajsk If a user logs into the app, logs out and then logs in again, then any logs generated "in between" the login attempts, will be stored with the 1st login's logs. By "in between", I mean "after the log-out", and "before the second log-in is completed". The issue can be observed by following these steps:
We will see:
We will see these logs:
Notice that the 3rd set of ( In general, any logs generated "after a log-out" and "before the next log-in is complete" will be stored with the former login's logs. Do you think there is any problem with this behaviour? Alternatively, we can choose to invoke |
Ah yes I think I missed this edge case since I was considering "sessions" as what happens after authentication. But yes I think I can fix this up fairly quick. Its now correctly logged like this,
|
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.
Good work 👍
There's some follow-up work needed:
-
For the web version, let's update the
Reporting problems in using CATcher
section in the usage docs, so users know how to download the logs. For the electron app, shall we stick to the logs generated byelectron-log
, as those include log statements from the main process as well?
Let's update the usage notes in this PR? -
Improve the testing for LoggingService (as discussed here, can do in a separate PR)
-
Briefly document how cached logging works in the Dev Notes (lower priority, can do separately)
Yeah I think we can stick to the logs generated by
Sure 👍
Yup I'm working on this in a local branch 👍 Will make a draft PR soon.
Yes I'll make an issue for this as a reminder as well 👍 |
Fixes #615
Summary
Caching of logs will now be done on
localStorage
which will be stored on the user's browser. We will be maintaining 4 sessions worth of logs in the cache but this number can be adjusted as per the app's requirement. A "Download Log" button has been added to the header should the user need to download the logs as a text file and submit it to us for inspection/troubleshooting.Download Log Button
Log Sample
Note
Test
mode (i.e.npm run ng:serve:test
but not logging inTest
mode and login is successfulnpm run ng:serve:web
)(with actual authentication). The repetition is caused by the logs from the OAuth Window[Note: The last log does not contain AppConfig ... as the the application was not restarted, the user simply logged out and back in]
Also Note
Since this is stored in
localStorage
the information can only be wiped programmatically or when the user clears their browser cache. There is a limit (typically 5-10MB) depending on the browser but I don't think we'd ever hit that especially since we are planning to limit the information based on some number of sessions (4 Sessions worth of Logs will currently be kept in the cache).Proposed Commit Message: