Skip to content

Commit

Permalink
Improve: Remove some clutter from debug.log (#635)
Browse files Browse the repository at this point in the history
* Improve: Remove some clutter from debug.log

* Improve: Remove some clutter from debug.log 2

* debug.disable_logging
  • Loading branch information
stoivo authored and randy3k committed May 2, 2017
1 parent 4f5583f commit 2938321
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion common/util/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pprint as _pprint

import sublime

from contextlib import contextmanager

_log = []
enabled = False
Expand All @@ -21,6 +21,16 @@ def stop_logging():
enabled = False


@contextmanager
def disable_logging():
global enabled
enabled = False
try:
yield
finally:
enabled = True


def get_log():
return json.dumps(_log, indent=2)

Expand Down
4 changes: 3 additions & 1 deletion core/commands/status_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from sublime_plugin import TextCommand, EventListener

from ..git_command import GitCommand
from ...common.util import debug


class GsStatusBarEventListener(EventListener):
Expand Down Expand Up @@ -57,7 +58,8 @@ def run_async(self):
self.view.erase_status("gitsavvy-repo-status")
return

short_status = self.get_branch_status_short()
with debug.disable_logging():
short_status = self.get_branch_status_short()
self.view.set_status("gitsavvy-repo-status", short_status)

global update_status_bar_soon
Expand Down

0 comments on commit 2938321

Please sign in to comment.