api/alfred: Write time and duration of alfred calls to file
Attention: This contains a hardcoded path! Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
af545d8194
commit
b2541fe40e
|
@ -12,6 +12,7 @@ import json
|
||||||
|
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
api = Blueprint("api", __name__)
|
api = Blueprint("api", __name__)
|
||||||
|
@ -109,8 +110,8 @@ def alfred():
|
||||||
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
|
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
|
||||||
#ps.print_stats()
|
#ps.print_stats()
|
||||||
#print(s.getvalue())
|
#print(s.getvalue())
|
||||||
#with open(CONFIG["debug_dir"] + "/apitime.txt", "a") as csv:
|
with open(CONFIG["debug_dir"] + "/apitime.txt", "a") as csv:
|
||||||
# csv.write("- %s seconds\n" % (time.time() - start_time))
|
csv.write(time.strftime('{%Y-%m-%d %H:%M:%S}') + " - %.3f seconds\n" % (time.time() - start_time))
|
||||||
r.mimetype = 'application/json'
|
r.mimetype = 'application/json'
|
||||||
return r
|
return r
|
||||||
except Exception as e: # most generic exception you can catch
|
except Exception as e: # most generic exception you can catch
|
||||||
|
|
Loading…
Reference in New Issue