From eb4697d192c636fe9183dbc1caf1e1f693117141 Mon Sep 17 00:00:00 2001 From: UltraQbik Date: Tue, 20 Aug 2024 18:58:07 +0300 Subject: Add logging --- main.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index 39ae8f3..4f82213 100644 --- a/main.py +++ b/main.py @@ -142,6 +142,10 @@ class HTTPServer: # decode request request: Request = Request.create(raw_request) + # log request + async with aiofiles.open("logs.log", "a") as f: + await f.write(f"IP: {client.getpeername()[0]}\n{request}\n\n") + # handle requests try: match request.type: -- cgit 1.4.1