diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-08-02 12:30:49 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-10-18 11:36:19 +0000 |
commit | bd38f3c2897c3f82f8c10464f70ed301c618dae7 (patch) | |
tree | f7c162973b153c92eace97e2b8fae00368afc85c /packaging-tools/optionparser.py | |
parent | a99a1b1cc95f82841ad0d605d6db14522b3fa754 (diff) |
Use logging functions from logging_util.py
-Remove inconsistent print function/logging module usage across scripts
-Initialize logger from logging_util.py
-Use CI friendly format in logging to stdout
-Log file format with extra debug information (script, line, process)
-Remove rainbow_logging_handler in favor of colorlog
-Remove unnecessary print/log functions from unit tests
-Remove unnecessary whitespace in logging messages
Change-Id: Ib913cf2f6a2b02e06628f94dceeeaf845191b96b
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Diffstat (limited to 'packaging-tools/optionparser.py')
-rw-r--r-- | packaging-tools/optionparser.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packaging-tools/optionparser.py b/packaging-tools/optionparser.py index 936113369..0ba90a2d1 100644 --- a/packaging-tools/optionparser.py +++ b/packaging-tools/optionparser.py @@ -34,6 +34,10 @@ import sys from configparser import ConfigParser from typing import Dict +from logging_util import init_logger + +log = init_logger(__name__, debug_mode=False) + class PackagingOptions: """Utility class to read options from configuration file that follows .ini file format.""" @@ -51,9 +55,9 @@ class PackagingOptions: try: dict1[option] = self.config.get(section, option) if dict1[option] == "-1": - print(f"skip: {option}") + log.info("skip: %s", option) except Exception: - print(f"exception on {option}!") + log.warning("exception on %s!", option) dict1[option] = "" return dict1 @@ -71,11 +75,10 @@ class PackagingOptions: def verbose(self) -> None: for section in self.config.sections(): - print(f"[{section}]") + log.info("[%s]", section) options = self.config.options(section) for option in options: - print(f"{option} = {self.config.get(section, option)}") - print() + log.info("%s = %s", option, self.config.get(section, option)) def get_pkg_options(conf_file_path: str) -> PackagingOptions: @@ -91,7 +94,7 @@ def main() -> None: # Print out all options options = get_pkg_options(args.conf_file) config_map = options.config_map() - print(config_map) + log.info(config_map) if __name__ == '__main__': |