From 1b90be34a4745927961a78ef9a1e6434268144b6 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Fri, 26 Oct 2018 23:03:50 +0200 Subject: [PATCH] logging query minor changes --- lib/wttr_srv.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/wttr_srv.py b/lib/wttr_srv.py index 6041198..a491557 100644 --- a/lib/wttr_srv.py +++ b/lib/wttr_srv.py @@ -170,10 +170,12 @@ def wttr(location, request): us_ip = query_source_location[1] == 'US' and 'slack' not in user_agent query = parse_query.metric_or_imperial(query, lang, us_ip=us_ip) - log(" ".join(map(str, [ - ip_addr, user_agent, (orig_location or "").encode('utf-8'), location, - query.get('use_imperial', False), lang - ]))) + # logging query + orig_location_utf8 = (orig_location or "").encode('utf-8') + location_utf8 = location.encode('utf-8') + use_imperial = query.get('use_imperial', False) + log(" ".join(map(str, + [ip_addr, user_agent, orig_location_utf8, location_utf8, use_imperial, lang]))) if country and location != NOT_FOUND_LOCATION: location = "%s, %s" % (location, country)