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

Restructure the Logger #1433

Closed
3 tasks done
vinitamurthi opened this issue Jul 1, 2020 · 15 comments · Fixed by #5396
Closed
3 tasks done

Restructure the Logger #1433

vinitamurthi opened this issue Jul 1, 2020 · 15 comments · Fixed by #5396
Assignees
Labels
enhancement End user-perceivable enhancements. Impact: Low Low perceived user impact (e.g. edge cases). Issue: Needs Clarification Indicates that an issue needs more detail in order to be able to be acted upon. Work: Low Solution is clear and broken into good-first-issue-sized chunks. Z-ibt Temporary label for Ben to keep track of issues he's triaged.

Comments

@vinitamurthi
Copy link
Contributor

vinitamurthi commented Jul 1, 2020

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

vinitamurthi added a commit that referenced this issue Jul 2, 2020
* Rename the logger class to consoleLogger

* Add more logger changes

* Lint fixes

* More lint fixes

* Remove extra 0
@BenHenning BenHenning added this to the Backlog milestone Jul 22, 2020
vinitamurthi added a commit that referenced this issue Jul 28, 2020
…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
@BenHenning
Copy link
Sponsor Member

BenHenning commented Sep 25, 2020

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.

@BenHenning
Copy link
Sponsor Member

@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?

@vinitamurthi
Copy link
Contributor Author

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.

@Sarthak2601
Copy link
Contributor

Sarthak2601 commented Sep 25, 2020

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.

@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.

@BenHenning
Copy link
Sponsor Member

BenHenning commented Sep 29, 2020

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.

@Aditiwebd
Copy link
Contributor

Please assign it to me @Sarthak2601

@Arjupta
Copy link
Contributor

Arjupta commented Apr 20, 2021

@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?

@vinitamurthi
Copy link
Contributor Author

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 Arjupta assigned Arjupta and unassigned Aditiwebd Apr 20, 2021
@Sarthak2601
Copy link
Contributor

Sarthak2601 commented Apr 20, 2021

@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.

rt4914 pushed a commit that referenced this issue May 13, 2021
* Using OppiaLogger as the central logging tool

* Fixing Lint Issues

* nit change

* Included tests for Console Logger Methods

* Suggested Changes
@rt4914
Copy link
Contributor

rt4914 commented Nov 18, 2021

@Arjupta Unassigning you from this issue because of inactivity, please re-assign yourself if you are currently working on this.

@Broppia Broppia added issue_type_infrastructure Impact: Low Low perceived user impact (e.g. edge cases). labels Jun 13, 2022
@BenHenning BenHenning added Issue: Needs Clarification Indicates that an issue needs more detail in order to be able to be acted upon. Z-ibt Temporary label for Ben to keep track of issues he's triaged. issue_user_developer labels Sep 15, 2022
@BenHenning BenHenning removed this from the Backlog milestone Sep 16, 2022
@seanlip seanlip added enhancement End user-perceivable enhancements. and removed issue_type_infrastructure labels Mar 28, 2023
@MohitGupta121 MohitGupta121 added the Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. label Jun 16, 2023
@BenHenning
Copy link
Sponsor Member

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.

@github-actions github-actions bot reopened this Mar 29, 2024
Copy link

The issue is reopened because of the following unresolved TODOs:

// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.

// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.

// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.

@BenHenning
Copy link
Sponsor Member

Aha, looks like there are a few TODOs to resolve before this can be fully closed.

XichengSpencer added a commit to XichengSpencer/oppia-android that referenced this issue May 7, 2024
@adhiamboperes adhiamboperes added Work: Low Solution is clear and broken into good-first-issue-sized chunks. and removed Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. labels May 17, 2024
adhiamboperes added a commit to XichengSpencer/oppia-android that referenced this issue May 20, 2024
adhiamboperes added a commit that referenced this issue May 20, 2024
…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 <59600948+adhiamboperes@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement End user-perceivable enhancements. Impact: Low Low perceived user impact (e.g. edge cases). Issue: Needs Clarification Indicates that an issue needs more detail in order to be able to be acted upon. Work: Low Solution is clear and broken into good-first-issue-sized chunks. Z-ibt Temporary label for Ben to keep track of issues he's triaged.
Development

Successfully merging a pull request may close this issue.