Skip to content

Commit

Permalink
Now we have a log file
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpeach committed Mar 16, 2024
1 parent 18945b7 commit 6cf014c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
log.txt
config.toml

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
9 changes: 9 additions & 0 deletions dogbarking/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from typing import Annotated
from datetime import datetime
import pyaudio
Expand All @@ -9,6 +10,7 @@
from dogbarking.math import get_rms
from loguru import logger

logger.add(sys.stderr, level="DEBUG")
app = typer.Typer()


Expand All @@ -35,8 +37,15 @@ def nogui(
seconds_per_buffer: Annotated[
float, typer.Argument(help="The number of seconds per buffer.", min=0.0)
] = 0.1,
log_file: Annotated[
str, typer.Option(help="The file to log to if you want to save events.")
] = None,
# email: Annotated[Optional[str], "The email to send the alert to."]=None
):
if log_file:
logger.add(log_file, level="INFO", colorize=False)
logger.info(f"Logging to {log_file}")

logger.warning("Remember to turn your volume all the way up!")

# Start Recording
Expand Down

0 comments on commit 6cf014c

Please sign in to comment.