|
18 | 18 |
|
19 | 19 | import aw_client.queries
|
20 | 20 | import click
|
| 21 | +from aw_core.log import setup_logging |
21 | 22 | from desktop_notifier import DesktopNotifier
|
22 | 23 | from typing_extensions import TypeAlias
|
23 | 24 |
|
@@ -244,15 +245,12 @@ def test_category_alert():
|
244 | 245 |
|
245 | 246 | @click.group(invoke_without_command=True)
|
246 | 247 | @click.pass_context
|
247 |
| -@click.option("-v", "--verbose", is_flag=True, help="Enables verbose mode.") |
248 |
| -def main(ctx, verbose: bool): |
249 |
| - logging.basicConfig( |
250 |
| - level=logging.DEBUG if verbose else logging.INFO, |
251 |
| - format="%(asctime)s [%(levelname)5s] %(message)s" |
252 |
| - + (" (%(name)s.%(funcName)s:%(lineno)d)" if verbose else ""), |
253 |
| - datefmt="%Y-%m-%d %H:%M:%S", |
254 |
| - ) |
| 248 | +@click.option("-v", "--verbose", is_flag=True, help="Verbose logging.") |
| 249 | +@click.option("--testing", is_flag=True, help="Enables testing mode.") |
| 250 | +def main(ctx, verbose: bool, testing: bool): |
| 251 | + setup_logging("aw-notify", testing=testing, verbose=verbose, log_file=True) |
255 | 252 | logging.getLogger("urllib3").setLevel(logging.WARNING)
|
| 253 | + logger.info("Starting...") |
256 | 254 |
|
257 | 255 | if ctx.invoked_subcommand is None:
|
258 | 256 | ctx.invoke(start)
|
|
0 commit comments