ui: install logger that sends debug.extensions messages to stderr
authorYuya Nishihara <yuya@tcha.org>
Sat, 15 Dec 2018 16:24:08 +0900
changeset 40994 ab92e2111408
parent 40993 49d48489a16b
child 40995 19178aeb9b43
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."
mercurial/ui.py
--- a/mercurial/ui.py	Sat Dec 15 19:05:42 2018 +0900
+++ b/mercurial/ui.py	Sat Dec 15 16:24:08 2018 +0900
@@ -30,6 +30,7 @@
     encoding,
     error,
     formatter,
+    loggingutil,
     progress,
     pycompat,
     rcutil,
@@ -490,6 +491,14 @@
             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),