Formatting
This commit is contained in:
parent
95e1c3f38d
commit
d84aab7feb
2 changed files with 11 additions and 2 deletions
4
logs.py
4
logs.py
|
@ -33,7 +33,9 @@ def log(
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for line in message.split("\n"):
|
for line in message.split("\n"):
|
||||||
log = log + f"\r\n[{level}]{'['+origin+']' if origin else ''}[{time}] {line}"
|
log = (
|
||||||
|
log + f"\r\n[{level}]{'['+origin+']' if origin else ''}[{time}] {line}"
|
||||||
|
)
|
||||||
print(
|
print(
|
||||||
f"[{level}]{'['+origin+']' if origin else ''}[{time}] {line}",
|
f"[{level}]{'['+origin+']' if origin else ''}[{time}] {line}",
|
||||||
file=stream,
|
file=stream,
|
||||||
|
|
|
@ -15,7 +15,13 @@ class Globals: ...
|
||||||
|
|
||||||
|
|
||||||
TimeoutErrors = (TimeoutError, asyncio.exceptions.TimeoutError)
|
TimeoutErrors = (TimeoutError, asyncio.exceptions.TimeoutError)
|
||||||
DisconnectErrors = (ConnectionResetError, BrokenPipeError, IndexError, UnicodeDecodeError, *TimeoutErrors)
|
DisconnectErrors = (
|
||||||
|
ConnectionResetError,
|
||||||
|
BrokenPipeError,
|
||||||
|
IndexError,
|
||||||
|
UnicodeDecodeError,
|
||||||
|
*TimeoutErrors,
|
||||||
|
)
|
||||||
G = Globals()
|
G = Globals()
|
||||||
G.uniqueClients = 0
|
G.uniqueClients = 0
|
||||||
G.servers = {}
|
G.servers = {}
|
||||||
|
@ -593,6 +599,7 @@ async def connectServer(hostname: str, port: int):
|
||||||
log(line, "ERROR")
|
log(line, "ERROR")
|
||||||
raise FailedLinkError
|
raise FailedLinkError
|
||||||
|
|
||||||
|
|
||||||
async def runServer(address: str, port: int):
|
async def runServer(address: str, port: int):
|
||||||
global G
|
global G
|
||||||
server = await asyncio.start_server(handleClient, address, port)
|
server = await asyncio.start_server(handleClient, address, port)
|
||||||
|
|
Loading…
Reference in a new issue