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

Is there a way to turn off warnings? #108

Closed
facelessuser opened this issue Feb 12, 2023 · 4 comments
Closed

Is there a way to turn off warnings? #108

facelessuser opened this issue Feb 12, 2023 · 4 comments

Comments

@facelessuser
Copy link

facelessuser commented Feb 12, 2023

I have some documentation tests that build the documentation in strict mode to find any issues and then runs a spellchecker on the output afterward. I find it very frustrating that I get these warnings in particular:

WARNING  -  [git-revision-date-localized-plugin] '/Somepath/somefile.md' has no git logs, using current
            timestamp

I've specifically enabled the following to handle the fact that the file has no history yet I still get the warning which fails the build.

plugins:
  - search:
  - git-revision-date-localized:
      fallback_to_build_date: true

I want the tests to be able to pass in a release bundle that does not have git, so I need this warning to be optional if at all possible.

Are the warnings really necessary if I've explicitly told it to fallback to build date? Or can we make such warnings optional?

@timvink
Copy link
Owner

timvink commented Feb 20, 2023

Hi @facelessuser !

There currently is no way to silence these warnings.. but I agree there should be. More users are using strict mode like you are and want to remove the warnings (#89)

This is the line causing the warning:

# create timestamp
if commit_timestamp == "":
commit_timestamp = time.time()
logger.warning(
"[git-revision-date-localized-plugin] '%s' has no git logs, using current timestamp"
% path
)

Your specific example is not related to the fallback_to_build_date option setting, because git is not failing, it's just that there are not git entries for the file.

I see some options:

  1. Change all the warnings to info level, and add a new strict option to this plugin that would log warnings instead of info (and recommends users to use mkdocs --strict to create errors from warnings).
  2. Add a new option report_issues_as (need to find a better name) that you can set to "info" instead of a default "warning" .

I prefer the first option. Will try to pick this up somewhere this week!

@facelessuser
Copy link
Author

Sounds great! I'm agnostic to how they get silenced as long as it is possible 🙃. I'm fine with option 1.

@timvink timvink closed this as completed in e7f82de Mar 2, 2023
timvink added a commit that referenced this issue Mar 2, 2023
@timvink
Copy link
Owner

timvink commented Mar 2, 2023

New release v1.2.0 just pushed to pypi

@timvink
Copy link
Owner

timvink commented Mar 2, 2023

For future reference, to turn off warnings, you can now in your mkdocs.yml do:

plugins:
  - git-revision-date-localized:
      strict: false

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

No branches or pull requests

2 participants