Adding traceback info to the default error log (#176)

* Update socketify.py

* Update socketify.py
pull/180/head
leunga1000 2024-06-03 21:04:00 +01:00 zatwierdzone przez GitHub
rodzic 293b2a97c2
commit 2a398a3543
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 25 dodań i 24 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ import signal
import uuid
from urllib.parse import parse_qs, quote_plus, unquote_plus
import logging
import traceback
from .native import ffi, lib
from .loop import Loop
@ -33,7 +34,7 @@ def uws_missing_server_name(hostname, hostname_length, user_data):
handler(data)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception:\n %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -67,7 +68,7 @@ def uws_websocket_factory_drain_handler(ws, user_data):
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -89,7 +90,7 @@ def uws_websocket_drain_handler_with_extension(ws, user_data):
handler(ws)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -107,7 +108,7 @@ def uws_websocket_drain_handler(ws, user_data):
handler(ws)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -189,7 +190,7 @@ def uws_websocket_factory_subscription_handler(
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -232,7 +233,7 @@ def uws_websocket_subscription_handler(
)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -279,7 +280,7 @@ def uws_websocket_subscription_handler_with_extension(
)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -312,7 +313,7 @@ def uws_websocket_factory_open_handler(ws, user_data):
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -335,7 +336,7 @@ def uws_websocket_open_handler_with_extension(ws, user_data):
handler(ws)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -354,7 +355,7 @@ def uws_websocket_open_handler(ws, user_data):
handler(ws)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -396,7 +397,7 @@ def uws_websocket_factory_message_handler(ws, message, length, opcode, user_data
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -430,7 +431,7 @@ def uws_websocket_message_handler_with_extension(
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -458,7 +459,7 @@ def uws_websocket_message_handler(ws, message, length, opcode, user_data):
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -497,7 +498,7 @@ def uws_websocket_factory_pong_handler(ws, message, length, user_data):
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -524,7 +525,7 @@ def uws_websocket_pong_handler_with_extension(ws, message, length, user_data):
handler(ws, data)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -547,7 +548,7 @@ def uws_websocket_pong_handler(ws, message, length, user_data):
handler(ws, data)
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -587,7 +588,7 @@ def uws_websocket_factory_ping_handler(ws, message, length, user_data):
if dispose:
app._ws_factory.dispose(instances)
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -616,7 +617,7 @@ def uws_websocket_ping_handler_with_extension(ws, message, length, user_data):
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -641,7 +642,7 @@ def uws_websocket_ping_handler(ws, message, length, user_data):
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -691,7 +692,7 @@ def uws_websocket_factory_close_handler(ws, code, message, length, user_data):
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -737,7 +738,7 @@ def uws_websocket_close_handler_with_extension(ws, code, message, length, user_d
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -779,7 +780,7 @@ def uws_websocket_close_handler(ws, code, message, length, user_data):
except Exception as err:
logging.error(
"Uncaught Exception: %s" % str(err)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
@ -3420,7 +3421,7 @@ class App:
if self.error_handler is None:
try:
logging.error(
"Uncaught Exception: %s" % str(error)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
response.write_status(500).end("Internal Error")
finally:
@ -3437,7 +3438,7 @@ class App:
try:
# Error handler got an error :D
logging.error(
"Uncaught Exception: %s" % str(error)
"Uncaught Exception: %s" % traceback.format_exc()
) # just log in console the error to call attention
response.write_status(500).end("Internal Error")
finally: