From 4b2050d7899762c100e4b9d871d15437b3dec567 Mon Sep 17 00:00:00 2001 From: Stanislau Hlebik Date: Sun, 12 Mar 2017 12:01:45 -0700 Subject: [PATCH] logginghelper: add logging.configoptions Summary: Let's add option that contains a list of other config options to log. Test Plan: arc unit Reviewers: #mercurial, durham Reviewed By: durham Subscribers: durham, mjpieters, #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D4681336 Signature: t1:4681336:1489171115:dddd27032e945f37fcc846a511e3aaa9e83d29d3 --- hgext3rd/logginghelper.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hgext3rd/logginghelper.py b/hgext3rd/logginghelper.py index 70557d55da..9b6d3949f5 100644 --- a/hgext3rd/logginghelper.py +++ b/hgext3rd/logginghelper.py @@ -7,6 +7,13 @@ """This extension logs different pieces of information that will be used by SCM wrappers + +:: + + [logging] + # list of config options to log + configoptions = section1.option1,section2.option2 + """ import os @@ -20,7 +27,17 @@ def _localrepoinit(orig, self, baseui, path=None, create=False): reponame = self.ui.config('paths', 'default', path) if reponame: reponame = os.path.basename(reponame) + configoptstolog = self.ui.configlist('logging', 'configoptions') kwargs = {'repo': reponame} + for option in configoptstolog: + splitted = option.split('.') + if len(splitted) != 2: + continue + section, name = splitted + value = self.ui.config(section, name, None) + if value is not None: + kwargs[name] = value + self.ui.log("logginghelper", "", # ui.log requires a format string as args[0]. **kwargs)