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

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 16, 2018, 8:30 a.m.
Message ID <85b2948f95b7916920f9.1544949036@mimosa>
Download mbox | patch
Permalink /patch/37207/
State New
Headers show

Comments

Yuya Nishihara - Dec. 16, 2018, 8:30 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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."

Patch

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),