-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Improve: Remove some clutter from debug.log #635
Conversation
core/git_command.py
Outdated
@@ -72,7 +72,8 @@ def git(self, *args, | |||
decode=True, | |||
encode=True, | |||
stdin_encoding="UTF-8", | |||
custom_environ=None): | |||
custom_environ=None, | |||
skip_adding_to_log=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to me that it overkills. Maybe something like this (untested)?
from contextlib import contextmanager
@contextmanager
def disable_logging():
util.debug.stop_logging()
try:
yield
finally:
util.debug.start_logging()
with disable_logging():
short_status = self.get_branch_status_short()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_logging() is resetting the log.
but it looks better
@randy3k, I did't know of contextmanager. This is so much cleaner 🎉 |
core/commands/status_bar.py
Outdated
@@ -57,7 +58,8 @@ def run_async(self): | |||
self.view.erase_status("gitsavvy-repo-status") | |||
return | |||
|
|||
short_status = self.get_branch_status_short() | |||
with disable_logging(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug.disable_logging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are so right.
Thanks. |
It's not super nice but I prefer to have setting as arguments instead of state on an object.