RepoSense
RepoSense copied to clipboard
Quiet mode for logging
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
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
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, theCtrl + 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
Can I attempt this or is it still under discussion?
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.
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
.
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
.