Pārlūkot izejas kodu

Add additional logging

deadtom 4 dienas atpakaļ
vecāks
revīzija
cd7b759e44
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      nagbot.py

+ 3 - 2
nagbot.py

@@ -22,17 +22,18 @@ def live_now():  # Check if the stream is live
 
 def send_msg(msg):
     if live_now() is True:
+        logging.info(f'{get_now()} - Sending \"{nag}\"...')
         new_status = {'body': msg}
         headers = {'Authorization': f'Bearer {config.auth_bearer}'}
         response = requests.post(f'{config.owncast_url}/api/integrations/chat/send', data=json.dumps(new_status), headers=headers)
         return response.json()
     else:
-        logging.info(f'{get_now()} - Owncast stream is not live, so not sending.')
+        logging.info(f'{get_now()} - Owncast stream is not live, so not sending messages.')
 
 
 def main():
+    logging.info(f'{get_now()} - Starting nagbot...')
     for nag in config.nags:
-        logging.info(f'{get_now()} - Sending \"{nag}\"...')
         send_msg(nag)
         time.sleep(config.interval)  # Wait between messages