Add -l/--log-level option. Honor __cdist_loglevel env var. (#572)

Add -l/--log-level option, __cdist_loglevel -> __cdist_log_level; honor __cdist_log_level env var
This commit is contained in:
Darko Poljak 2017-09-09 21:17:29 +02:00 committed by GitHub
commit 3454da076f
23 changed files with 152 additions and 69 deletions

View file

@ -24,6 +24,7 @@ import logging
import os
import cdist
from . import util
'''
common:
@ -111,12 +112,9 @@ class Manifest(object):
'__target_fqdn': self.target_host[2],
'__files': self.local.files_path,
'__target_host_tags': self.local.target_host_tags,
'__cdist_log_level': util.log_level_env_var_val(self.log),
}
self.env.update(
{'__cdist_loglevel': logging.getLevelName(
self.log.getEffectiveLevel())})
def _open_logger(self):
self.log = logging.getLogger(self.target_host[0])