config: Introduce path for debug output

Includes update of file names for debug files.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2017-11-19 00:51:23 +01:00
parent 5e75f9cad0
commit af545d8194
3 changed files with 6 additions and 3 deletions

View File

@ -11,4 +11,5 @@ CONFIG = {
"event_num_entries": 20,
"global_stat_days": 30,
"csv_dir": "/var/lib/ffmap/csv",
"debug_dir": "/data/fff",
}

View File

@ -4,6 +4,7 @@ from ffmap.routertools import *
from ffmap.maptools import *
from ffmap.mysqltools import FreifunkMySQL
from ffmap.stattools import record_global_stats, record_hood_stats
from ffmap.config import CONFIG
from flask import Blueprint, request, make_response, redirect, url_for, jsonify, Response
from bson.json_util import dumps as bson2json
@ -108,12 +109,12 @@ def alfred():
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
#ps.print_stats()
#print(s.getvalue())
#with open("/data/fff/apitime.txt", "a") as csv:
#with open(CONFIG["debug_dir"] + "/apitime.txt", "a") as csv:
# csv.write("- %s seconds\n" % (time.time() - start_time))
r.mimetype = 'application/json'
return r
except Exception as e: # most generic exception you can catch
logf = open("/data/fff/fail00.txt", "a")
logf = open(CONFIG["debug_dir"] + "/fail_alfred.txt", "a")
logf.write("{}\n".format(e))
logf.close()

View File

@ -11,6 +11,7 @@ from ffmap import stattools
from ffmap.usertools import *
from ffmap.routertools import delete_router
from ffmap.web.helpers import *
from ffmap.config import CONFIG
from flask import Flask, render_template, request, Response, redirect, url_for, flash, session
import bson
@ -143,7 +144,7 @@ def router_info(dbid):
else:
return render_template("router.html", router=router, tileurls=tileurls, netifstats=netiffetch, neighstats=neighfetch)
except Exception as e: # most generic exception you can catch
logf = open("/data/fff/fail3.txt", "a")
logf = open(CONFIG["debug_dir"] + "/fail_router.txt", "a")
logf.write("{}\n".format(str(e)))
logf.close()