mirror of
https://github.com/chubin/cheat.sh.git
synced 2026-06-20 13:16:44 +02:00
Write log as binary file in Python 3
Fixes
File "bin/srv.py", line 101, in log_query
my_file.write(log_entry.encode('utf-8')+"\n")
TypeError: can't concat str to bytes
This commit is contained in:
+3
-3
@@ -96,9 +96,9 @@ def log_query(ip_addr, found, topic, user_agent):
|
||||
"""
|
||||
Log processed query and some internal data
|
||||
"""
|
||||
log_entry = "%s %s %s %s" % (ip_addr, found, topic, user_agent)
|
||||
with open(CONFIG["path.log.queries"], 'a') as my_file:
|
||||
my_file.write(log_entry.encode('utf-8')+"\n")
|
||||
log_entry = "%s %s %s %s\n" % (ip_addr, found, topic, user_agent)
|
||||
with open(CONFIG["path.log.queries"], 'ab') as my_file:
|
||||
my_file.write(log_entry.encode('utf-8'))
|
||||
|
||||
def get_request_ip(req):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user