Skip to content

Commit

Permalink
Merge pull request #47 from mauvehed/add-logging
Browse files Browse the repository at this point in the history
feat(bm_monitor.py): add logging of all messages
  • Loading branch information
mauvehed authored Feb 10, 2025
2 parents 5e72dd4 + d4ed69c commit 1bdf317
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions bm_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
level=logging.DEBUG if cfg.verbose else logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.StreamHandler() # Ensure logs are sent to stdout
logging.StreamHandler(), # Ensure logs are sent to stdout
logging.FileHandler("brandmeister.log", encoding="utf-8") # Log to file
]
)

Expand Down Expand Up @@ -183,21 +184,15 @@ def connect():

@sio.on("mqtt")
def on_mqtt(data):
"""Processes MQTT messages from the Brandmeister network and manages notification logic.
"""Processes MQTT messages from the Brandmeister network and manages notification logic."""

This function handles incoming MQTT messages by evaluating communication events, tracking activity across talkgroups and callsigns, and triggering notifications based on configured criteria. It determines whether a communication event meets the notification requirements and dispatches messages through configured notification channels.
Args:
data (dict): A dictionary containing the MQTT payload with communication event details.
Returns:
None
"""
call = json.loads(data['payload'])

# Log all messages received
logging.info(f"Received Brandmeister message: {json.dumps(call, indent=2)}")

tg = call["DestinationID"]
callsign = call["SourceCall"]
talkeralias = call["TalkerAlias"]
start_time = call["Start"]
stop_time = call["Stop"]
event = call["Event"]
Expand Down

0 comments on commit 1bdf317

Please sign in to comment.