logging improved

This commit is contained in:
Remy Moll 2021-06-30 15:34:43 +02:00
parent 2d62aa55ff
commit 57f1f77327
7 changed files with 53 additions and 22 deletions

View File

@ -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"""

View File

@ -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()

View File

@ -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
View 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

View File

@ -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

View File

@ -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

View File

@ -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"""