Fix module name in load_logging function
After refactoring the log function to tripleo-repos utils[1], the module name 'tripleo-get-hash' become hardcoded in load_logging function. Now, this function accepts the module name as parameter. [1]: https://review.opendev.org/c/openstack/tripleo-repos/+/815991 Change-Id: I6840870cf5b55ee1d47e3634009f1c5ec7045b6f Signed-off-by: Douglas Viroel <dviroel@redhat.com>
This commit is contained in:
parent
50c7cf01fd
commit
4012795760
|
@ -32,7 +32,7 @@ def _validate_args(parsed_args):
|
|||
|
||||
|
||||
def main():
|
||||
load_logging()
|
||||
load_logging(module_name="tripleo-get-hash")
|
||||
config = TripleOHashInfo.load_config()
|
||||
parser = argparse.ArgumentParser(description='tripleo-get-hash.py')
|
||||
parser.add_argument(
|
||||
|
|
|
@ -56,7 +56,7 @@ else:
|
|||
return (str(e), -1)
|
||||
|
||||
|
||||
def load_logging(level=logging.INFO):
|
||||
def load_logging(level=logging.INFO, module_name="tripleo-repos"):
|
||||
"""Load and set logging level. Default is set to logging.INFO level."""
|
||||
logger = logging.getLogger()
|
||||
# Only add logger once to avoid duplicated streams in tests
|
||||
|
@ -73,7 +73,7 @@ def load_logging(level=logging.INFO):
|
|||
if stdout_handlers == []:
|
||||
formatter = logging.Formatter(
|
||||
(
|
||||
"%(asctime)s - tripleo-get-hash - %(levelname)s - "
|
||||
"%(asctime)s - " + module_name + " - %(levelname)s - "
|
||||
"%(message)s"
|
||||
)
|
||||
)
|
||||
|
|
|
@ -38,7 +38,7 @@ def options_to_dict(options):
|
|||
|
||||
|
||||
def main():
|
||||
load_logging()
|
||||
load_logging(module_name="tripleo-yum-config")
|
||||
# Get release model and version
|
||||
distro, major_version, __ = utils.get_distro_info()
|
||||
py_version = sys.version_info.major
|
||||
|
|
Loading…
Reference in New Issue