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

Use proper logging in auth module #2604

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Use proper logging in auth module #2604

merged 3 commits into from
Oct 15, 2024

Conversation

hanouticelina
Copy link
Contributor

This is a small PR to use proper logging in the authentication module.

Changes made

  • replacing print statements by proper logging with the level that reflects the severity of the messages.
  • replacing some warnings.warn() by logger.warning() following logging best practices : Python Logging HOWTO
  • setting verbosity level to INFO for authentication commands.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Nice QoL improvement!

@@ -222,11 +221,11 @@ def auth_list() -> None:
print(f"{is_current} {{:<{max_offset}}}| {{:<15}}".format(token_name, masked_token))

if _get_token_from_environment():
print(
logger.info(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.info(
logger.warning(

(nit) maybe a warning here as it might lead to an unexpected behavior for the user (if not aware of it)

@hanouticelina
Copy link
Contributor Author

thanks @Wauplin for the review! your comment is addressed in 87ab6d4. Let's merge :)

@hanouticelina hanouticelina merged commit c9d7865 into main Oct 15, 2024
19 checks passed
@hanouticelina hanouticelina deleted the improve-auth-logging branch October 15, 2024 13:32
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.

3 participants