diff --git a/git/cmd.py b/git/cmd.py index 7c9c89737..f92afcbe8 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -410,14 +410,14 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool: # following values: # # 0|q|quiet|s|silence|n|none - # 1|w|warn|warning - # 2|r|raise|e|error + # 1|w|warn|warning|log + # 2|r|raise|e|error|exception mode = os.environ.get(cls._refresh_env_var, "raise").lower() quiet = ["quiet", "q", "silence", "s", "none", "n", "0"] - warn = ["warn", "w", "warning", "1"] - error = ["error", "e", "raise", "r", "2"] + warn = ["warn", "w", "warning", "log", "1"] + error = ["error", "e", "exception", "raise", "r", "2"] if mode in quiet: pass @@ -428,10 +428,10 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool: %s All git commands will error until this is rectified. - This initial warning can be silenced or aggravated in the future by setting the + This initial message can be silenced or aggravated in the future by setting the $%s environment variable. Use one of the following values: - - %s: for no warning or exception - - %s: for a printed warning + - %s: for no message or exception + - %s: for a warning message (logged at level ERROR, displayed by default) - %s: for a raised exception Example: @@ -450,7 +450,7 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool: ) if mode in warn: - print("WARNING: %s" % err) + _logger.error("WARNING: %s", err) else: raise ImportError(err) else: @@ -460,8 +460,8 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool: %s environment variable has been set but it has been set with an invalid value. Use only the following values: - - %s: for no warning or exception - - %s: for a printed warning + - %s: for no message or exception + - %s: for a warning message (logged at level ERROR, displayed by default) - %s: for a raised exception """ )