[PATCH 3 of 5] ui: install logger that sends debug.extensions messages to stderr

Yuya Nishihara yuya at tcha.org
Sun Dec 16 03:30:36 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1544858648 -32400
#      Sat Dec 15 16:24:08 2018 +0900
# Node ID 85b2948f95b7916920f9af6f556a9ef0c36dee49
# Parent  51f6fb41be9b7b16157f5fc3a421b04c037b455e
ui: install logger that sends debug.extensions messages to stderr

This will replace the custom log function introduced at d58958676b3c
"extensions: add detailed loading information."

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -30,6 +30,7 @@ from . import (
     encoding,
     error,
     formatter,
+    loggingutil,
     progress,
     pycompat,
     rcutil,
@@ -490,6 +491,14 @@ class ui(object):
             self._trustusers.update(self.configlist('trusted', 'users'))
             self._trustgroups.update(self.configlist('trusted', 'groups'))
 
+        if section in (None, b'devel', b'ui') and self.debugflag:
+            tracked = set()
+            if self.configbool(b'devel', b'debug.extensions'):
+                tracked.add(b'extension')
+            if tracked:
+                logger = loggingutil.fileobjectlogger(self._ferr, tracked)
+                self.setlogger(b'debug', logger)
+
     def backupconfig(self, section, item):
         return (self._ocfg.backup(section, item),
                 self._tcfg.backup(section, item),


More information about the Mercurial-devel mailing list