Skip to content

Commit

Permalink
Merge pull request #6 from ryanpeach/feature/log-level
Browse files Browse the repository at this point in the history
Now have a log level flag
  • Loading branch information
ryanpeach authored Mar 16, 2024
2 parents 41170d2 + a455dd1 commit b009cd4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dogbarking/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
import sys
from typing import Annotated, Optional
from datetime import datetime
import pyaudio
Expand Down Expand Up @@ -68,7 +69,22 @@ def nogui(
help="The SMTP port to send the email.", envvar="DOGBARKING_SMTP_PORT"
),
] = 465,
log_level: Annotated[
str,
typer.Option(
help="The logging level to use.",
),
] = "INFO",
):
"""Dog Barking Alert System"""

# Set up the logger
logger.remove(0)
logger.add(
sys.stderr,
level=log_level,
)

# Check that the email details are provided if any of them are provided
use_email = any(
[sender_email, receiver_email, smtp_password, smtp_server, smtp_port]
Expand Down

0 comments on commit b009cd4

Please sign in to comment.