Skip to content
Snippets Groups Projects
Commit fbedbfe7 authored by Chris Hines's avatar Chris Hines
Browse files

more logging

parent 2690009d
No related branches found
No related tags found
2 merge requests!83was trying to get the tunnel based on the csrf-token header which is wrong. So...,!82was trying to get the tunnel based on the csrf-token header which is wrong. So...
Pipeline #55185 passed
......@@ -107,7 +107,7 @@ class TWSProxy(threading.Thread):
import re
import requests
logger = logging.getLogger()
token_format = [ b'Authorization: token (?P<authtok>\w+)[\W|$]',
token_formats = [ b'Authorization: token (?P<authtok>\w+)[\W|$]',
b'token=(?P<authtok>\w+)[&|\W|$]',
b'twsproxyauth=(?P<authtok>\w+)[\W|$]']
......@@ -184,6 +184,7 @@ def mainserver(port=None):
import logging
import sys
import os
to_log=None
try:
from logging.handlers import TimedRotatingFileHandler
logger = logging.getLogger()
......@@ -192,12 +193,14 @@ def mainserver(port=None):
handler.setFormattter(formatter)
logger.addHandler(handler)
except Exception as e:
print(e)
import traceback
print(traceback.format_exc())
to_log = "{}\n".format(e)
to_log = to_log + traceback.format_exc()
logging.basicConfig(filename=os.path.expanduser("~/.tws.log"),format="%(asctime)s %(levelname)s:%(process)s: %(message)s")
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
if to_log is not None:
logger.debug(to_log)
logger.debug("starting TWS proxy")
if port is None:
try:
......
......@@ -34,6 +34,7 @@ class TWSServer:
while not self.stop.is_set():
try:
(clientsocket, address) = serversocket.accept()
logger.debug('accepted connection {}'.format(clientsocket))
except socket.timeout:
continue
clientsocket.setblocking(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment