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

logger: allow exc_info in all record types #3290

Merged
merged 1 commit into from
Feb 9, 2020
Merged

Conversation

efiop
Copy link
Contributor

@efiop efiop commented Feb 9, 2020

This better reflects the original logger formatter and is neede for further improvements in the following PRs.

This also fixes annoying redundant newline between traceback and "need
any help" footer.

  • ❗ Have you followed the guidelines in the Contributing to DVC list?

  • 📖 Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.

  • ❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@efiop efiop changed the title logger: allow exc_info in all record types [WIP] logger: allow exc_info in all record types Feb 9, 2020
@@ -51,37 +51,29 @@ class ColorFormatter(logging.Formatter):

color_code = {
"DEBUG": colorama.Fore.BLUE,
"INFO": "",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was never used.

"WARNING": colorama.Fore.YELLOW,
"ERROR": colorama.Fore.RED,
"CRITICAL": colorama.Fore.RED,
}

def format(self, record):
msg = record.msg.format(*record.args) if record.args else record.msg
exception, stack_trace = self._parse_exc(record)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

docstring said that exc_info is accounted for, but it wasn't unless record was at ERROR or CRITICAL levels.

@efiop efiop changed the title [WIP] logger: allow exc_info in all record types logger: allow exc_info in all record types Feb 9, 2020
This better reflects the original logger formatter.

This also fixes annoying redundant newline between traceback and "need
any help" footer.
@efiop efiop merged commit 2786a4e into iterative:master Feb 9, 2020
@efiop efiop added the ui user interface / interaction label Feb 9, 2020
@efiop efiop self-assigned this Feb 9, 2020
@ghost ghost mentioned this pull request Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui user interface / interaction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant