Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now have a log level flag #6

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading