logging improved
This commit is contained in:
		
							
								
								
									
										15
									
								
								client.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								client.py
									
									
									
									
									
								
							| @@ -5,6 +5,21 @@ from broadcast import b_in | ||||
| import launcher | ||||
|  | ||||
|  | ||||
| import logging | ||||
| import os | ||||
|  | ||||
| if os.name == "nt": | ||||
|     # development | ||||
|     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/client.log', | ||||
|     ) | ||||
|  | ||||
|  | ||||
| class ReceiverLauncher(launcher.Launcher): | ||||
|     """Launcher for all server-side modules. The hard-computations""" | ||||
|   | ||||
| @@ -30,6 +30,7 @@ try: | ||||
|     GPIO.setmode(GPIO.BCM) | ||||
|     GPIO.setup(4, GPIO.IN) | ||||
| except ImportError: | ||||
|     logger.warn("Simulating sensor modules") | ||||
|     dht11 = TempSim() | ||||
|     GPIO = LightSim() | ||||
|  | ||||
|   | ||||
							
								
								
									
										17
									
								
								launcher.py
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								launcher.py
									
									
									
									
									
								
							| @@ -1,22 +1,5 @@ | ||||
| from persistence import p_io, p_out | ||||
|  | ||||
| import logging | ||||
| import os | ||||
|  | ||||
|  | ||||
|  | ||||
| if os.name == "nt": | ||||
|     # development | ||||
|     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', | ||||
|     ) | ||||
|  | ||||
|  | ||||
| class Launcher: | ||||
|     """base launcher that launches other submodules""" | ||||
|   | ||||
							
								
								
									
										17
									
								
								req_pi.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								req_pi.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| Adafruit-Blinka==6.10.3 | ||||
| adafruit-circuitpython-dht==3.6.1 | ||||
| Adafruit-PlatformDetect==3.14.2 | ||||
| Adafruit-PureIO==1.1.9 | ||||
| board==1.0 | ||||
| importlib-metadata==4.6.0 | ||||
| pkg-resources==0.0.0 | ||||
| psycopg2==2.9.1 | ||||
| psycopg2-binary==2.9.1 | ||||
| pyftdi==0.53.1 | ||||
| pyserial==3.5 | ||||
| pyusb==1.1.1 | ||||
| rpi-ws281x==4.3.0 | ||||
| RPi.GPIO==0.7.0 | ||||
| sysv-ipc==1.1.0 | ||||
| typing-extensions==3.10.0.0 | ||||
| zipp==3.4.1 | ||||
| @@ -1,6 +1,6 @@ | ||||
| #!/home/pi/AIO/VE/bin/python3 | ||||
| #!/bin/bash | ||||
|  | ||||
| sleep 15 # gpio not inited right after boot? | ||||
|  | ||||
| cd /home/pi/AIO/ | ||||
| python3 client.py | ||||
| VE/bin/python3 client.py | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| #!/home/pi/AIO/VE/bin/python3 | ||||
|  | ||||
| #!/bin/bash | ||||
|  | ||||
| sleep 15 # gpio not inited right after boot? | ||||
|  | ||||
| cd /home/pi/AIO/ | ||||
| python3 server.py | ||||
| VE/bin/python3 server.py | ||||
|   | ||||
							
								
								
									
										16
									
								
								server.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								server.py
									
									
									
									
									
								
							| @@ -7,6 +7,22 @@ from broadcast import b_out | ||||
| import launcher | ||||
|  | ||||
|  | ||||
| import logging | ||||
| import os | ||||
|  | ||||
| if os.name == "nt": | ||||
|     # development | ||||
|     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/server.log', | ||||
|     ) | ||||
|  | ||||
|  | ||||
|  | ||||
| class BroadcastLauncher(launcher.Launcher): | ||||
|     """Launcher for all server-side modules. The hard-computations""" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Remy Moll
					Remy Moll