RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

Quiet mode for logging

Open yhtMinceraft1010X opened this issue 3 years ago • 4 comments

What feature(s) would you like to see in RepoSense?

Currently, RepoSense logs are quite detailed, which may not always be useful to the layperson. An example would be "Waiting for cloning of... to complete..." messages seen below, which seem redundant since there is already a "Cloning in parallel..." message for each waiting message.

If possible, describe the solution

Screenshot (126)

Implement a quiet mode logging using a --quiet or -q flag. Some INFO level logs can be downgraded to FINE level.

By default, our LogsManager uses INFO-level logging. The default minimum logging level can be changed to FINE level so that all the messages can still be logged for debugging purposes while INFO-level logging can be kept for quiet mode so that essential information such as where the report is generated is shown to the user.

To complement quiet mode, messages for FINE level logging can be kept in Supplier<String> objects so that these messages are not constructed when quiet mode is set.

Logging of WARNING and SEVERE messages will remain unchanged.

If applicable, describe alternatives you've considered

Screenshot (127)

More granularity can be provided by using FINER level logging. In which case, the new proposed log levels would be as such:

  • INFO - for strictly essential information such as where the report is generated, the URL link and port, the Ctrl + C message
  • FINE - for tracking overall progress of a normal run. E.g. "Cloning in parallel from...", "Cloning... completed!", "Analyzing...", "Analysis... completed!"
  • FINER - for tracking individual steps in a stage. E.g. "Waiting for cloning of...", "Extracing commits info"

How to use these logging levels:

Minimum logging level Usage
FINER Use a --debug or -D flag to display these messages. Needs to be specified for tests and system tests.
FINE Default level. FINER log messages will be suppressed.
INFO Use a --quiet or -Q flag to suppress FINER and FINE messages. Only log messages at INFO level or above will be displayed.

Additional context Java 8 API for Logger and Level:

  • https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html
  • https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html

yhtMinceraft1010X avatar Feb 21 '22 06:02 yhtMinceraft1010X

Can I attempt this or is it still under discussion?

SkyBlaise99 avatar Jul 18 '22 10:07 SkyBlaise99

Can I attempt this or is it still under discussion?

This is still under review. One concern I have is that the proposed usage of logging levels here may be incorrect/against convention.

yhtMinceraft1010X avatar Jul 19 '22 05:07 yhtMinceraft1010X

I see. Just some clarification regarding this improvement that you might want to add on to the description.

Currently LogsManager controls logging to both console and file. I believe that only changing the level of logging for the console is sufficient, logging to file should still maintain the details. currentFileLogLevel can be set to Level.FINER so all the logs will still be shown in the files.

Actually my idea for this will be that console will only show parts of the logs that are deemed important to the user (errors, warning, important infos). The files will contain all the logs which will be used for debugging purposes. In this case, there won't be a need for quiet mode or debug mode anymore. The console will always be in quiet mode while the files can be used for debug mode.

SkyBlaise99 avatar Jul 19 '22 06:07 SkyBlaise99

Anyways I wrote some code here which can be used in the future when the details are finalized. Just need to update the levels etc. I have included the quiet and debug flags and updated InputBuilder for systemtest.

SkyBlaise99 avatar Jul 20 '22 02:07 SkyBlaise99