From 729cba9d74f34ea284bce4cd1d215ff632ed49a6 Mon Sep 17 00:00:00 2001 From: Nathan Henrie Date: Mon, 13 May 2024 13:04:07 -0600 Subject: [PATCH] Configure logging verbosity from CLI --- src/pycookiecheat/__main__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pycookiecheat/__main__.py b/src/pycookiecheat/__main__.py index e2e7842..f95cc76 100644 --- a/src/pycookiecheat/__main__.py +++ b/src/pycookiecheat/__main__.py @@ -2,6 +2,7 @@ import argparse import json +import logging from .chrome import chrome_cookies from .common import BrowserType @@ -23,9 +24,17 @@ def main() -> None: "--output-file", help="Output to this file in netscape cookie file format", ) + parser.add_argument( + "--verbose", + "-v", + action="count", + default=0, + help="Increase logging verbosity (may repeat), default is `logging.ERROR`", + ) args = parser.parse_args() # todo: make this a match statement once MSPV is 3.10 + logging.basicConfig(level=max(logging.ERROR - 10 * args.verbose, 0)) browser = BrowserType(args.browser)