Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Jan 22, 2021

Check whether CLILogging already has been configured and return as early as possible, otherwise, calls like

self.log_level = self._determine_log_level(args)

is totally unnecessary and is merely a waste of time.

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 22, 2021

Log

@jiasli jiasli force-pushed the logger-configured branch from 6618199 to 9276c0a Compare January 25, 2021 03:26
@jiasli jiasli force-pushed the logger-configured branch from 9276c0a to 67ba8c3 Compare January 25, 2021 09:11
@jiasli jiasli force-pushed the logger-configured branch from 67ba8c3 to 7a5d837 Compare January 25, 2021 10:02
@jiasli jiasli merged commit c6f2aed into microsoft:master Jan 25, 2021
@jiasli jiasli deleted the logger-configured branch January 25, 2021 10:05
@jiasli jiasli mentioned this pull request Jan 26, 2021
Comment on lines +129 to +133
root_logger = logging.getLogger()

if root_logger.handlers:
# handlers already configured
return
Copy link
Member Author

Choose a reason for hiding this comment

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

When run in pytest environment, root_logger is already set by pytest. If we don't return here before cli_logger.propagate = False, cli_logger.propagate = False will take effect and intercepts all logs sent to cli_loggers.

With this change, all logs will be handled by pytest directly.

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.

5 participants