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

[HOTFIX] Fix the bug in loguru that cannot display special tags #266

Merged
merged 3 commits into from
May 29, 2024

Conversation

DavdGao
Copy link
Collaborator

@DavdGao DavdGao commented May 29, 2024

Background

  • logger.chat cannot display special tags normally. (e.g. html labels and special tags begin with "<")

Reason

  • In current version, we use the color label in loguru to display message with colored names, which will be mixed with labels within name and content

What in this PR

  • We display the color by special tags in terminal, e.g. \033[90m
  • To avoid saving the special tags (\033[90m) in files, we call logger.log twice (Lines 131-132, 143-144). The first time we display message in terminal with special tags, the second time we save this messages into files without these special tags.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@DavdGao
Copy link
Collaborator Author

DavdGao commented May 29, 2024

@qbc2016 please check if the fix would affect the message display in studio.

Copy link
Collaborator

@pan-x-c pan-x-c left a comment

Choose a reason for hiding this comment

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

LGTM

@DavdGao DavdGao merged commit b754920 into modelscope:main May 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for review
Projects
None yet
2 participants