D6611: blackbox: disable extremely verbose logging (issue6110)

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Wed Jul 10 18:12:30 EDT 2019


valentin.gatienbaron updated this revision to Diff 15887.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6611?vs=15787&id=15887

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6611/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6611

AFFECTED FILES
  hgext/blackbox.py
  tests/test-blackbox.t

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -22,9 +22,6 @@
   > [alias]
   > confuse = log --limit 3
   > so-confusing = confuse --style compact
-  > [blackbox]
-  > track = backupbundle, branchcache, command, commandalias, commandexception,
-  >         commandfinish, debug, exthook, incoming, pythonhook, tagscache
   > EOF
 
   $ hg init blackboxtest
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -9,12 +9,14 @@
 """log repository events to a blackbox for debugging
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
-The events that get logged can be configured via the blackbox.track config key.
+The events that get logged can be configured via the blackbox.track and
+blackbox.ignore config keys.
 
 Examples::
 
   [blackbox]
   track = *
+  ignore = pythonhook
   # dirty is *EXPENSIVE* (slow);
   # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
   dirty = True
@@ -84,6 +86,9 @@
 configitem('blackbox', 'track',
     default=lambda: ['*'],
 )
+configitem('blackbox', 'ignore',
+    default=lambda: ['chgserver', 'cmdserver', 'extension'],
+)
 configitem('blackbox', 'date-format',
     default='%Y/%m/%d %H:%M:%S',
 )
@@ -94,12 +99,15 @@
     def __init__(self, ui, repo):
         self._repo = repo
         self._trackedevents = set(ui.configlist('blackbox', 'track'))
+        self._ignoredevents = set(ui.configlist('blackbox', 'ignore'))
         self._maxfiles = ui.configint('blackbox', 'maxfiles')
         self._maxsize = ui.configbytes('blackbox', 'maxsize')
         self._inlog = False
 
     def tracked(self, event):
-        return b'*' in self._trackedevents or event in self._trackedevents
+        return ((b'*' in self._trackedevents
+                 and event not in self._ignoredevents)
+                or event in self._trackedevents)
 
     def log(self, ui, event, msg, opts):
         # self._log() -> ctx.dirty() may create new subrepo instance, which



To: valentin.gatienbaron, #hg-reviewers
Cc: durin42, mercurial-devel


More information about the Mercurial-devel mailing list