Merged
Conversation
Modified the way logging is initialized to fix two things. 1. If the import of `colorlog` fails the logs will still be formatted using the expected HASS log format. 2. Ensure that `logging.basicConfig` is called AFTER `colorlog` is imported so that the default handler generated will be writing to the wrapped stream generated when `colorama` is initialized. This allows colored logging to work on Windows. Added support for a `--log-no-color` command line switch in the event that someone just wants to disable colored log output entirely.
2 tasks
balloob
reviewed
Apr 16, 2018
| verbose: bool = False, | ||
| log_rotate_days=None, | ||
| log_file=None, | ||
| log_no_color: bool = True) -> None: |
Member
There was a problem hiding this comment.
This should not default to True
Contributor
Author
There was a problem hiding this comment.
Whoops, I initially implemented this as log_color, but then switched it around to make using the new switch statement more clean. I'll switch all these to False.
balloob
reviewed
Apr 16, 2018
| log_rotate_days: Any = None, | ||
| log_file: Any = None): | ||
| log_file: Any = None, | ||
| log_no_color: bool = True): |
balloob
reviewed
Apr 16, 2018
| log_rotate_days: Any = None, | ||
| log_file: Any = None): | ||
| log_file: Any = None, | ||
| log_no_color: bool = True): |
balloob
reviewed
Apr 16, 2018
| log_rotate_days: Any = None, | ||
| log_file: Any = None) \ | ||
| log_file: Any = None, | ||
| log_no_color: bool = True) \ |
balloob
reviewed
Apr 16, 2018
| log_rotate_days: Any = None, | ||
| log_file: Any = None) \ | ||
| log_file: Any = None, | ||
| log_no_color: bool = True) \ |
Contributor
Author
|
Updated the defaults to false everywhere. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Fix colorlog on windows
Modified the way logging is initialized to fix two things.
colorlogfails the logs will still be formattedusing the expected HASS log format.
logging.basicConfigis called AFTERcolorlogisimported so that the default handler generated will be writing to the
wrapped stream generated when
coloramais initialized. This allowscolored logging to work on Windows.
Added support for a
--log-no-colorcommand line switch in the eventthat someone just wants to disable colored log output entirely.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5193
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed: