Better logs and better timings
This commit is contained in:
		
							
								
								
									
										15
									
								
								launcher.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								launcher.py
									
									
									
									
									
								
							| @@ -10,10 +10,19 @@ import persistence.main | ||||
| # various | ||||
| import logging | ||||
| from threading import Thread | ||||
| import os | ||||
|  | ||||
| if os.name == "nt": | ||||
|     logging.basicConfig( | ||||
|         format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO | ||||
|     ) | ||||
| else: | ||||
|     logging.basicConfig( | ||||
|         format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | ||||
|         level=logging.INFO, | ||||
|         filename='persistence/complete.log', | ||||
|     ) | ||||
|  | ||||
| logging.basicConfig( | ||||
|     format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO | ||||
| ) | ||||
|  | ||||
| class Launcher(): | ||||
|     """Launches all other submodules""" | ||||
|   | ||||
							
								
								
									
										13
									
								
								t.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								t.py
									
									
									
									
									
								
							| @@ -1,13 +0,0 @@ | ||||
| import bot2.main | ||||
| import persistence.main | ||||
|  | ||||
| import logging | ||||
| logging.basicConfig( | ||||
|     format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | ||||
|     level=logging.INFO, | ||||
|     #filename='persistence/complete.log', | ||||
| ) | ||||
| logger = logging.getLogger(__name__) | ||||
| prst = persistence.main.PersistentDict("persistence/prst.json") | ||||
|  | ||||
| test = bot2.main.ChatBot("Test", ".1", "HW", prst, logger) | ||||
							
								
								
									
										10
									
								
								wrapper.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								wrapper.py
									
									
									
									
									
								
							| @@ -36,7 +36,6 @@ class ClockWrapper(Wrapper): | ||||
|     def START(self): # I prefer the name tick_tack | ||||
|         """Runs the showing of the clock-face periodically: update every minute"""     | ||||
|         def perform_loop(): | ||||
|             logger.warning("NEW TIME") | ||||
|             t = int(datetime.datetime.now().strftime("%H%M")) | ||||
|  | ||||
|             if t % 5 == 0: | ||||
| @@ -45,7 +44,6 @@ class ClockWrapper(Wrapper): | ||||
|  | ||||
|                 if weather != self.weather_raw and len(weather) != 0: | ||||
|                     td = weather[1] | ||||
|  | ||||
|                     low = td["temps"][0] | ||||
|                     high = td["temps"][1] | ||||
|                     self.weather["weather"] = td["short"] | ||||
| @@ -62,16 +60,16 @@ class ClockWrapper(Wrapper): | ||||
|                 else: | ||||
|                     next = "weather" | ||||
|                 self.weather["show"] = next | ||||
|  | ||||
|             self.prev_time = datetime.datetime.now().strftime("%H%M") | ||||
|  | ||||
|      | ||||
|             self.own.set_face(self.weather) | ||||
|          | ||||
|         perform_loop() | ||||
|         while datetime.datetime.now().strftime("%H%M%S")[-2:] != "00": | ||||
|             pass | ||||
|         RepeatedTimer(60, perform_loop) | ||||
|          | ||||
|  | ||||
|  | ||||
|  | ||||
| class BotWrapper(Wrapper): | ||||
|     """Wrapper for the BOT-functionality""" | ||||
|     def __init__(self, own_module, *other_modules): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Remy Moll
					Remy Moll