decode utf-8 before logging

This commit is contained in:
Igor Chubin 2017-06-02 15:47:18 +00:00
parent c0fd0249b6
commit 6491bfbe70

View file

@ -87,7 +87,7 @@ def send_malformed():
def log_query(ip, found, topic, user_agent):
log_entry = "%s %s %s %s" % (ip, found, topic, user_agent)
with open(FILE_QUERIES_LOG, 'a') as my_file:
my_file.write(log_entry+"\n")
my_file.write(log_entry.encode('utf-8')+"\n")
@app.route("/", methods=['GET', 'POST'])
@app.route("/<path:topic>", methods=["GET", "POST"])