Skip to content

Commit

Permalink
keep error.log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferrariic committed May 25, 2022
1 parent c657178 commit 83aea86
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
19 changes: 11 additions & 8 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
# import logging_loki
from dotenv import find_dotenv, load_dotenv
from fastapi import FastAPI

# from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.cors import CORSMiddleware

# load environment variables
load_dotenv(find_dotenv(), verbose=True)
Expand All @@ -18,14 +17,18 @@
# create application
app = FastAPI()

# app.add_middleware(
# CORSMiddleware,
# allow_credentials=True,
# allow_methods=["*"],
# allow_headers=["*"],
# )
app.add_middleware(
CORSMiddleware,
allow_credentials=True,
allow_methods=["*"],
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
1 change: 1 addition & 0 deletions logs/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error.log

0 comments on commit 83aea86

Please sign in to comment.