-
Notifications
You must be signed in to change notification settings - Fork 539
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
Restructure the Logger #1433
Comments
* Rename the logger class to consoleLogger * Add more logger changes * Lint fixes * More lint fixes * Remove extra 0
…ing to it (#1499) * Add an oppia logger directory * Move analytics controller to oppia logger * Modify usage of analytics controller * OppiaLoggerTest introduction * Lint fixes * More lint fixes * Review changes * Fix KDoc of oppia logger * Fix subtopic data type change * Fix comment in AnalyticsController * Remove comment from OppiaLogger
150 seems a bit high for this @Sarthak2601, doesn't it? I'd expect this to be roughly 1 medium-sized PR unless I'm missing some aspect of this. Though maybe 2 PRs if it also includes updating all logger references to use the new OppiaLogger, but that's a fairly straightforward find-and-replace. |
@vinitamurthi one question: if OppiaLogger is in domain/ and used by domain/ & app/ for console logging, does that mean all other modules will still use ConsoleLogger? That seems like an inconsistency we might not want since it may lead to confusion. WDYT? |
Today yes, but as we had discussed we will move this to its own module in blaze so this confusion should be short lived. Unfortunately with the way its structured right now, we have no other proper choice. |
@BenHenning We estimated it to be a 150 pointer since the contributor will have to understand the logging, combine it into one place, replace the existing implementations and write test cases. However, we can initially put it in as a 75 pointer and then later on decide if we want to increase it to 150 when anyone creates a PR. |
That sounds good, thanks @Sarthak2601. Ack @vinitamurthi. I suppose the alternative is to not introduce OppiaLogger until we can introduce it cleanly, but since it already exists, we might as well leverage it as broadly as we can. :) I don't have a strong opinion about this. |
Please assign it to me @Sarthak2601 |
@Sarthak2601 and @vinitamurthi I would like to work on this Issue. Just a simple question. The task which is now left is to use Oppia Logger everywhere and route the log requests according to different log command? |
I think that's right. I beleive all other logging should be part of oppialogger now so we should just have to update callers. |
@Arjupta Yes, that's partially correct. You'll have to add public methods in the logger to ensure all other logging (currently it's just analytics that we do) via the logger, update the logging calls everywhere and then write corresponding test cases. |
* Using OppiaLogger as the central logging tool * Fixing Lint Issues * nit change * Included tests for Console Logger Methods * Suggested Changes
@Arjupta Unassigning you from this issue because of inactivity, please re-assign yourself if you are currently working on this. |
Per @adhiamboperes's suggestion, this can be closed now. In fact, it's probably gone from being completed to obsolete since we've decided to expand OppiaLogger back into specialized loggers. I think we still don't have a strong sense of what a good logger architecture looks like in the app yet. I'm still holding out hope for google/flogger#186 as it will allow us to at least differentiate console & error logging with analytics (which can use a more domain-specific paradigm), but I think we should just live with the current approach and iterate on it as seems reasonable. |
The issue is reopened because of the following unresolved TODOs: Line 197 in d0c8b81
Line 84 in d0c8b81
Line 134 in d0c8b81
|
Aha, looks like there are a few TODOs to resolve before this can be fully closed. |
…5396) <!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> ## Explanation Fix #1433 There are 3 TODO marks the place where we want to have both have log in both Console and Exception Loggers By checking 3 related TODOs, only TODO in ExceptionController needs to add the exception logger for logging and I added it as the issue required and removed the TODO comment. The other 2 TODOs already meet the requirement of the issue, so I simply deleted TODO comments. <!-- - Explain what your PR does. If this PR fixes an existing bug, please include - "Fixes #bugnum:" in the explanation so that GitHub can auto-close the issue - when this PR is merged. --> ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only <!-- Delete these section if this PR does not include UI-related changes. --> If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing --------- Co-authored-by: Adhiambo Peres <[email protected]>
With the way we have loggers right now, app/domain files would have to fetch multiple types of loggers for different types of logging. We want to refactor it so that atleast app/domain modules can use a single logger: Oppia Logger.
This restructuring will have multiple parts to it:
Rename Logger.kt -> ConsoleLogger.kt since that's what it does (Data/Utility module files will use this file directly)
Create an OppiaLogger.kt file in the domain module. All App/Domain module files will use this logger
Oppia Logger will route the log command to the lower lying logger:
- logException routes to ExceptionLogger (or exceptionController)
- logTransition/logClick routes to the AnalyticsController
- .v/.d etc commands route to the ConsoleLogger
The text was updated successfully, but these errors were encountered: