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

Refactoring of Logger module #1785

Merged
merged 4 commits into from
Mar 1, 2023
Merged

Refactoring of Logger module #1785

merged 4 commits into from
Mar 1, 2023

Conversation

pavel-karatsiuba
Copy link
Contributor

@pavel-karatsiuba pavel-karatsiuba commented Feb 16, 2023

Use ['info', 'log', 'warn', 'error'] as values for --verbose

fixes: #674

@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Base: 70.35% // Head: 70.42% // Increases project coverage by +0.07% 🎉

Coverage data is based on head (b26ec2e) compared to base (8a1fbe1).
Patch coverage: 83.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1785      +/-   ##
==========================================
+ Coverage   70.35%   70.42%   +0.07%     
==========================================
  Files          23       23              
  Lines        2587     2597      +10     
  Branches      591      594       +3     
==========================================
+ Hits         1820     1829       +9     
  Misses        661      661              
- Partials      106      107       +1     
Impacted Files Coverage Δ
src/Downloader.ts 59.87% <ø> (ø)
src/Dump.ts 82.17% <ø> (ø)
src/MediaWiki.ts 81.57% <ø> (ø)
src/RedisStore.ts 74.54% <ø> (ø)
src/S3.ts 0.00% <ø> (ø)
src/util/articleRenderers.ts 71.27% <ø> (ø)
src/util/categories.ts 0.00% <ø> (ø)
src/util/dump.ts 76.62% <ø> (ø)
src/util/misc.ts 72.35% <ø> (ø)
src/util/mw-api.ts 83.06% <ø> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the value given should be checked, --verbose=ddd just pass. Like any other argument it should be check and if wrong an error should be displayed and mwoffliner should exit.
  • In the usage, default value if nothing specified should be documented.
  • It should be explain as well that the chosen level print also all the level greather than this. So if you should warn, you will get warn and errors
  • Everything should be written to STDOUT except the errors, which should be printed to the STDERR
  • Not sure, but I think default behaviour should print error, so like --verbose=error. Doing so would imply to not have any more solution for a "silent" mode... maybe a --verbose=none would be a solution?

@pavel-karatsiuba
Copy link
Contributor Author

Added sanitizing for verbose option.
The verbose option can be empty or one of "info", "log", "warn", "error", or "quiet".
An empty value is equal to "info".
The default level is "error".
If --verbose=quiet then don't print messages.

Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase and resolve conflicts, have also left a small style feedback

src/Logger.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kelson42 kelson42 merged commit ad56c6b into main Mar 1, 2023
@kelson42 kelson42 deleted the logger-refactoring branch March 1, 2023 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--verbose should be able to get a log threshold
2 participants