implement utils.print_exception()
Previously we used logging.error(e) and traceback.print_exc() to output error stack trace. The problem is, we want to output the stack trace only when verbose > 0. The if statement scattered around the code. So we replaced them with the new utils.print_exception() call.
This commit is contained in:
@ -69,7 +69,7 @@ import struct
|
||||
import errno
|
||||
import random
|
||||
|
||||
from shadowsocks import encrypt, eventloop, lru_cache, common
|
||||
from shadowsocks import encrypt, eventloop, lru_cache, common, utils
|
||||
from shadowsocks.common import parse_header, pack_addr
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ class UDPRelay(object):
|
||||
if err in (errno.EINPROGRESS, errno.EAGAIN):
|
||||
pass
|
||||
else:
|
||||
logging.error(e)
|
||||
utils.print_exception(e)
|
||||
|
||||
def _handle_client(self, sock):
|
||||
data, r_addr = sock.recvfrom(BUF_SIZE)
|
||||
|
Reference in New Issue
Block a user