Skip to content

Commit

Permalink
fix: fixed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 27, 2023
1 parent 4efe542 commit d1d0dec
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions aw_notify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import aw_client.queries
import click
from aw_core.log import setup_logging
from desktop_notifier import DesktopNotifier
from typing_extensions import TypeAlias

Expand Down Expand Up @@ -244,15 +245,12 @@ def test_category_alert():

@click.group(invoke_without_command=True)
@click.pass_context
@click.option("-v", "--verbose", is_flag=True, help="Enables verbose mode.")
def main(ctx, verbose: bool):
logging.basicConfig(
level=logging.DEBUG if verbose else logging.INFO,
format="%(asctime)s [%(levelname)5s] %(message)s"
+ (" (%(name)s.%(funcName)s:%(lineno)d)" if verbose else ""),
datefmt="%Y-%m-%d %H:%M:%S",
)
@click.option("-v", "--verbose", is_flag=True, help="Verbose logging.")
@click.option("--testing", is_flag=True, help="Enables testing mode.")
def main(ctx, verbose: bool, testing: bool):
setup_logging("aw-notify", testing=testing, verbose=verbose, log_file=True)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logger.info("Starting...")

if ctx.invoked_subcommand is None:
ctx.invoke(start)
Expand Down

0 comments on commit d1d0dec

Please sign in to comment.