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

Changed default -v level #13839

Merged
merged 3 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions conan/api/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,29 @@ def define_silence_warnings(cls, warnings):

@classmethod
def define_log_level(cls, v):
levels = {"quiet": LEVEL_QUIET, # -vquiet 80
"error": LEVEL_ERROR, # -verror 70
"warning": LEVEL_WARNING, # -vwaring 60
"notice": LEVEL_NOTICE, # -vnotice 50
"status": LEVEL_STATUS, # -vstatus 40
None: LEVEL_STATUS, # -v 40
"verbose": LEVEL_VERBOSE, # -vverbose 30
"debug": LEVEL_DEBUG, # -vdebug 20
"v": LEVEL_DEBUG, # -vv 20
"trace": LEVEL_TRACE, # -vtrace 10
"vv": LEVEL_TRACE, # -vvv 10
}

level = levels.get(v)
if not level:
"""
Translates the verbosity level entered by a Conan command. If it's `None` (-v),
it will be defaulted to `verbose` level.

:param v: `str` or `None`, where `None` is the same as `verbose`.
"""
try:
level = {"quiet": LEVEL_QUIET, # -vquiet 80
"error": LEVEL_ERROR, # -verror 70
"warning": LEVEL_WARNING, # -vwaring 60
"notice": LEVEL_NOTICE, # -vnotice 50
"status": LEVEL_STATUS, # -vstatus 40
None: LEVEL_VERBOSE, # -v 30
"verbose": LEVEL_VERBOSE, # -vverbose 30
"debug": LEVEL_DEBUG, # -vdebug 20
"v": LEVEL_DEBUG, # -vv 20
"trace": LEVEL_TRACE, # -vtrace 10
"vv": LEVEL_TRACE # -vvv 10
}[v]
except KeyError:
raise ConanException(f"Invalid argument '-v{v}'")
cls._conan_output_level = level
else:
cls._conan_output_level = level

@classmethod
def level_allowed(cls, level):
Expand Down
4 changes: 2 additions & 2 deletions conans/test/integration/command_v2/test_output_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def test_output_level():
assert "This is a warning" in t.out
assert "This is a error" in t.out

# Print also verbose traces
# Check if -v argument is equal to VERBOSE level
t.run("create . --name foo --version 1.0 -v")
assert "This is a trace" not in t.out
assert "This is a debug" not in t.out
assert "This is a verbose" not in t.out
assert "This is a verbose" in t.out
assert "This is a info" in t.out
assert "This is a highlight" in t.out
assert "This is a success" in t.out
Expand Down