From a70800323e4932d1885a210315af8c986bd2f7f9 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Sun, 19 Jun 2022 22:30:17 +0300 Subject: cli logging mode --- kvmd/apps/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'kvmd/apps/__init__.py') 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( -- cgit v1.2.3