diff options
author | Maxim Devaev <[email protected]> | 2022-06-19 22:30:17 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-19 22:30:17 +0300 |
commit | a70800323e4932d1885a210315af8c986bd2f7f9 (patch) | |
tree | d6501a2220775653266c917bf6ecde5c56e57854 /kvmd/apps/__init__.py | |
parent | 804bb68ae3fe21a79cfde0de91ce6e11642a5bb8 (diff) |
cli logging mode
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r-- | kvmd/apps/__init__.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 314c6b1b..cef0a6a4 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -113,6 +113,7 @@ def init( description: Optional[str]=None, add_help: bool=True, check_run: bool=False, + cli_logging: bool=False, argv: Optional[List[str]]=None, **load: bool, ) -> Tuple[argparse.ArgumentParser, List[str], Section]: @@ -152,6 +153,11 @@ def init( logging.captureWarnings(True) logging.config.dictConfig(config.logging) + if cli_logging: + logging.getLogger().handlers[0].setFormatter(logging.Formatter( + "-- {levelname:>7} -- {message}", + style="{", + )) if check_run and not options.run: raise SystemExit( |