improvements in logging
This commit is contained in:
@@ -65,7 +65,7 @@ class DataLogger:
|
|||||||
n_fast = 1
|
n_fast = 1
|
||||||
n_perm = 1
|
n_perm = 1
|
||||||
while logging:
|
while logging:
|
||||||
logging.info("Data Logger logging")
|
logging.debug("Data Logger logging")
|
||||||
columns = list(("time", ))
|
columns = list(("time", ))
|
||||||
|
|
||||||
for i in range(SENSOR_BASEID, SENSOR_BASEID + 8):
|
for i in range(SENSOR_BASEID, SENSOR_BASEID + 8):
|
||||||
|
|||||||
18
app/plot.py
18
app/plot.py
@@ -69,11 +69,11 @@ def plot_all(user=None):
|
|||||||
plot_total(user)
|
plot_total(user)
|
||||||
plot_total()
|
plot_total()
|
||||||
plot_list(4)
|
plot_list(4)
|
||||||
logging.info('plot_all')
|
logging.info('Plotter: plot_all')
|
||||||
|
|
||||||
|
|
||||||
def plot_total(user=None):
|
def plot_total(user=None):
|
||||||
logging.info("start plot_total")
|
logging.debug("start plot_total")
|
||||||
|
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
delta = datetime.timedelta(days=1)
|
delta = datetime.timedelta(days=1)
|
||||||
@@ -138,11 +138,11 @@ def plot_total(user=None):
|
|||||||
fils = "app/static/total%03d.png" % user.id
|
fils = "app/static/total%03d.png" % user.id
|
||||||
fill = "app/static/total%03d_big.png" % user.id
|
fill = "app/static/total%03d_big.png" % user.id
|
||||||
plt.title(tit)
|
plt.title(tit)
|
||||||
logging.info("Plot plot_total " + str(datetime.datetime.now()))
|
logging.debug("Plot plot_total " + str(datetime.datetime.now()))
|
||||||
#480x320
|
#480x320
|
||||||
fig.set_size_inches(4.8, 3.2)
|
fig.set_size_inches(4.8, 3.2)
|
||||||
plt.savefig(fils, dpi=100)
|
plt.savefig(fils, dpi=100)
|
||||||
logging.info("Plot: End plot_total " + str(datetime.datetime.now()))
|
logging.debug("Plot: End plot_total " + str(datetime.datetime.now()))
|
||||||
#fig.set_size_inches(4.8, 3.2)
|
#fig.set_size_inches(4.8, 3.2)
|
||||||
#plt.savefig(fill, dpi=400)
|
#plt.savefig(fill, dpi=400)
|
||||||
|
|
||||||
@@ -201,18 +201,18 @@ def plot_log(logfiles, hours):
|
|||||||
ax.xaxis.set_major_formatter(AutoDateFormatter(defaultfmt='%d.%m'))
|
ax.xaxis.set_major_formatter(AutoDateFormatter(defaultfmt='%d.%m'))
|
||||||
#f.autofmt_xdate()
|
#f.autofmt_xdate()
|
||||||
except:
|
except:
|
||||||
logging.warning("Plot: Few data!")
|
logging.debug("Plot: Few data!")
|
||||||
#plt.xlabel('Datum')
|
#plt.xlabel('Datum')
|
||||||
#plt.ylabel('Temperatur / C')
|
#plt.ylabel('Temperatur / C')
|
||||||
outfile = "app/static/log_" + str(item) + ".png"
|
outfile = "app/static/log_" + str(item) + ".png"
|
||||||
logging.info("Plot plot_log " + str(datetime.datetime.now()))
|
logging.debug("Plot plot_log " + str(datetime.datetime.now()))
|
||||||
#480x320
|
#480x320
|
||||||
plt.gcf().set_size_inches(5.3, 2.4)
|
plt.gcf().set_size_inches(5.3, 2.4)
|
||||||
plt.tight_layout()
|
plt.tight_layout()
|
||||||
plt.savefig(outfile, dpi=70, transparent=True, bbox_inches='tight')
|
plt.savefig(outfile, dpi=70, transparent=True, bbox_inches='tight')
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
logging.info("Plot: End plot_log " + str(datetime.datetime.now()))
|
logging.debug("Plot: End plot_log " + str(datetime.datetime.now()))
|
||||||
|
|
||||||
|
|
||||||
def plot_list(duration):
|
def plot_list(duration):
|
||||||
@@ -292,11 +292,11 @@ def plot_list(duration):
|
|||||||
|
|
||||||
plt.title("Bierliste ("+ str(duration) + " Wochen)")
|
plt.title("Bierliste ("+ str(duration) + " Wochen)")
|
||||||
|
|
||||||
logging.info("Plot plot_list " + str(datetime.datetime.now()))
|
logging.debug("Plot plot_list " + str(datetime.datetime.now()))
|
||||||
#800x600
|
#800x600
|
||||||
fig.set_size_inches(15, 10)
|
fig.set_size_inches(15, 10)
|
||||||
plt.savefig('app/static/bierliste_small.png', dpi=72, bbox_inches='tight')
|
plt.savefig('app/static/bierliste_small.png', dpi=72, bbox_inches='tight')
|
||||||
#1024x768
|
#1024x768
|
||||||
#fig.set_size_inches(10.24, 7.68)
|
#fig.set_size_inches(10.24, 7.68)
|
||||||
#plt.savefig('app/static/bierliste.png', dpi=100)
|
#plt.savefig('app/static/bierliste.png', dpi=100)
|
||||||
logging.info("Plot: End plot_list " + str(datetime.datetime.now()))
|
logging.debug("Plot: End plot_list " + str(datetime.datetime.now()))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
while true; do
|
while true; do
|
||||||
su - pi -c 'cd /home/pi/baroness && FRAMEBUFFER=/dev/fb1 startx ./run.py'
|
su - pi -c 'cd /home/pi/baroness && FRAMEBUFFER=/dev/fb1 startx ./run.py > baroness.out'
|
||||||
now=$(date)
|
now=$(date)
|
||||||
echo "Current time : $now" >> restart.log
|
echo "Current time : $now" >> restart.log
|
||||||
killall pigpiod
|
killall pigpiod
|
||||||
|
|||||||
2
run.py
2
run.py
@@ -18,7 +18,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#logging!
|
#logging!
|
||||||
logfile = "baroness.log"
|
logfile = "baroness.log"
|
||||||
logging.basicConfig(filename=logfile, level=logging.WARNING)
|
logging.basicConfig(filename=logfile, level=logging.INFO, format='%(asctime)s - %(name)s - %(message)s')
|
||||||
#logging.basicConfig(level=logging.DEBUG)
|
#logging.basicConfig(level=logging.DEBUG)
|
||||||
logging.info("Baroness started!")
|
logging.info("Baroness started!")
|
||||||
print "Baroness started: logging to ", logfile
|
print "Baroness started: logging to ", logfile
|
||||||
|
|||||||
Reference in New Issue
Block a user