Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferrariic committed May 25, 2022
1 parent d5b6e7a commit 39790d3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
5 changes: 0 additions & 5 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
allow_headers=["*"],
)

# setup logging
try:
os.mkdir("logs/error.log")
except FileExistsError:
pass
file_handler = logging.FileHandler(filename="logs/error.log", mode="a")
stream_handler = logging.StreamHandler(sys.stdout)

Expand Down
19 changes: 19 additions & 0 deletions api/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import logging
import time

from fastapi import Request

from api.config import app

logger = logging.getLogger(__name__)


@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time

url = request.url.remove_query_params("token")._url
logger.debug({"url": url, "process_time": process_time})
return response
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ Please contact [email protected] for any questions regarding this reposit
# Auth Levels

0 - User

1 - User with Entry Dev Privs

2 - User with Dev Privs

3 - User with Higher Dev Privs

4 - Customer Support Starter

5 - Customer Support Junior

6 - Customer Support Senior

7 - Customer Support Lead/Tech Junior

8 - Tech Senior

9 - CEO/CTO

0 comments on commit 39790d3

Please sign in to comment.