Skip to content

Commit 47357b2

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
commands: add option to select debug level logging in sambacc
Signed-off-by: John Mulligan <[email protected]>
1 parent 9fff6da commit 47357b2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sambacc/commands/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ def global_args(parser: Parser) -> None:
118118
" Pass `?` for more details)."
119119
),
120120
)
121+
parser.add_argument(
122+
"--debug",
123+
action="store_true",
124+
help="Enable debug level logging of sambacc.",
125+
)
121126

122127

123128
def _ceph_id(
@@ -293,13 +298,14 @@ def pre_action(cli: typing.Any) -> None:
293298

294299

295300
def enable_logging(cli: typing.Any) -> None:
301+
level = logging.DEBUG if cli.debug else logging.INFO
296302
logger = logging.getLogger()
297-
logger.setLevel(logging.INFO)
303+
logger.setLevel(level)
298304
handler = logging.StreamHandler()
299305
handler.setFormatter(
300306
logging.Formatter("{asctime}: {levelname}: {message}", style="{")
301307
)
302-
handler.setLevel(logging.INFO)
308+
handler.setLevel(level)
303309
logger.addHandler(handler)
304310

305311

0 commit comments

Comments
 (0)