about summary refs log tree commit diff
path: root/main.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-20 18:58:07 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-20 18:58:07 +0300
commiteb4697d192c636fe9183dbc1caf1e1f693117141 (patch)
tree94e8c97bbc95b6ee531abfc4bdb1d8a6812662ff /main.py
parent2778b7de51e0c732e295c7ace4ce4a7e400d25b4 (diff)
downloadhttpy-eb4697d192c636fe9183dbc1caf1e1f693117141.tar.gz
httpy-eb4697d192c636fe9183dbc1caf1e1f693117141.zip
Add logging
Diffstat (limited to 'main.py')
-rw-r--r--main.py4
1 files changed, 4 insertions, 0 deletions
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: