mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
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
This commit is contained in:
parent
33a1d6afdc
commit
4b2050d789
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user