chore: Update logging format and add debug messages
- Changed the logging format in `trackbert.py` to include date, time, and message level. - Added debug messages to show the number of events retrieved for a tracking number.
This commit is contained in:
parent
9802e28454
commit
018cccb6a1
1 changed files with 7 additions and 3 deletions
10
trackbert.py
10
trackbert.py
|
@ -7,8 +7,12 @@ import subprocess
|
|||
import argparse
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
# Print date and time and level with message
|
||||
logging.basicConfig(
|
||||
format="%(asctime)s %(levelname)s: %(message)s",
|
||||
level=logging.DEBUG,
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
)
|
||||
|
||||
def notify(title, message):
|
||||
logging.debug(f"Sending notification: {title} - {message}")
|
||||
|
@ -117,7 +121,7 @@ def start_loop(db, api: KeyDelivery):
|
|||
all_events = api.realtime(carrier, tracking_number)
|
||||
|
||||
try:
|
||||
all_events["data"]["items"]
|
||||
logging.debug(f"Got events for {tracking_number}: {len(all_events)}")
|
||||
except KeyError:
|
||||
print(f"Error getting events for {tracking_number}: {all_events}")
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue