repo: get default logger level from logger

This commit is contained in:
pared
2019-04-29 17:41:38 -07:00
parent 8bb21261e3
commit a1b12db00f
3 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ class Config(object): # pylint: disable=too-many-instance-attributes
SECTION_CORE_STORAGEPATH = "storagepath" SECTION_CORE_STORAGEPATH = "storagepath"
SECTION_CORE_SCHEMA = { SECTION_CORE_SCHEMA = {
Optional(SECTION_CORE_LOGLEVEL, default="info"): And( Optional(SECTION_CORE_LOGLEVEL): And(
str, Use(str.lower), SECTION_CORE_LOGLEVEL_SCHEMA str, Use(str.lower), SECTION_CORE_LOGLEVEL_SCHEMA
), ),
Optional(SECTION_CORE_REMOTE, default=""): And(str, Use(str.lower)), Optional(SECTION_CORE_REMOTE, default=""): And(str, Use(str.lower)),
+3 -5
View File
@@ -68,11 +68,9 @@ class Repo(object):
core = self.config.config[Config.SECTION_CORE] core = self.config.config[Config.SECTION_CORE]
logger.setLevel( level = core.get(Config.SECTION_CORE_LOGLEVEL)
logging.getLevelName( if level:
core.get(Config.SECTION_CORE_LOGLEVEL, "info").upper() logger.setLevel(level.upper())
)
)
self.cache = Cache(self) self.cache = Cache(self)
self.cloud = DataCloud(self, config=self.config.config) self.cloud = DataCloud(self, config=self.config.config)
+7
View File
@@ -64,3 +64,10 @@ class TestInitNoSCM(TestDir):
self.assertEqual(ret, 0) self.assertEqual(ret, 0)
self._test_init() self._test_init()
def test_init_quiet_should_not_display_welcome_screen(git, caplog):
ret = main(["init", "--quiet"])
assert 0 == ret
assert "" == caplog.text