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

Accept logging level names (#5765) #5772

Merged
merged 7 commits into from Nov 7, 2019

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented Sep 19, 2019

Now any user can set Conan logging level using common names as debug, info, critical ...

Related Issue: #5765
Changelog: Feature: Accept logging level as logging names
Docs: conan-io/docs#1419

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member Author

@uilianries uilianries commented Sep 19, 2019

Seems like the parallel test has some fragility. I can't reproduce the same behavior when running virtual env on my machine.

uilianries added 2 commits Sep 19, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member Author

@uilianries uilianries commented Sep 19, 2019

The functional tests was contaminated by env vars.

conans/util/log.py Outdated Show resolved Hide resolved
self.assertEqual(logging.DEBUG, config.logging_level)

def test_log_level_numbers_invalid(self):
save(os.path.join(self.tmp_dir, CONAN_CONF), default_client_conf_log.format("level = wakawaka"))
Copy link
Contributor

@lasote lasote Sep 25, 2019

Choose a reason for hiding this comment

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

Wow. Shouldn't we rise?

Copy link
Member Author

@uilianries uilianries Sep 25, 2019

Choose a reason for hiding this comment

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

from early condition, any error is treated as default logging level (CRITICAL). Should we change it?

Copy link
Member Author

@uilianries uilianries Sep 25, 2019

Choose a reason for hiding this comment

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

@@ -506,7 +507,8 @@ def logging_level(self):
if level is None:
level = self.get_item("log.level")
try:
level = int(level)
parsed_level = get_log_level_by_name(level)
level = parsed_level if parsed_level is not None else int(level)
Copy link
Contributor

@lasote lasote Sep 25, 2019

Choose a reason for hiding this comment

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

int("wakawaka") doesn't crash?

Copy link
Member Author

@uilianries uilianries Sep 25, 2019

Choose a reason for hiding this comment

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

ditto

Signed-off-by: Uilian Ries <uilianries@gmail.com>
jgsogo
jgsogo approved these changes Nov 6, 2019
Copy link
Member

@jgsogo jgsogo left a comment

Let's go ahead with this little change, I always have to think about the pairing between numbers and log-levels.

@lasote lasote added this to the 1.21 milestone Nov 6, 2019
@lasote
Copy link
Contributor

@lasote lasote commented Nov 6, 2019

@jgsogo all yours.

Copy link
Member

@jgsogo jgsogo left a comment

Please, @uilianries, consider these changes to keep the environment modification local to the test-case (uilianries#15) and I'll merge 😉

Keep environment modification local to the testcase
@uilianries
Copy link
Member Author

@uilianries uilianries commented Nov 7, 2019

@jgsogo Done, it has been merged!

jgsogo
jgsogo approved these changes Nov 7, 2019
Copy link
Member

@jgsogo jgsogo left a comment

Perfect. Now move to the docs, we have the opportunity to improve them a little bit 👍

@jgsogo jgsogo merged commit 814a0fd into conan-io:develop Nov 7, 2019
2 checks passed
@jgsogo jgsogo removed their assignment Nov 11, 2019
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.

None yet

3 participants