Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Oct 22, 2024
1 parent d964d02 commit 824685e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def logs_filepath(self) -> str:
settings = Settings()

# Disable uvicorn logs, does not seems to really do much
uvicorn_error = logging.getLogger("uvicorn.error")
uvicorn_error.disabled = True
# uvicorn_error = logging.getLogger("uvicorn.error")
# uvicorn_error.disabled = True
uvicorn_access = logging.getLogger("uvicorn.access")
uvicorn_access.disabled = True

Expand Down
7 changes: 4 additions & 3 deletions backend/src/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def insert_triples(
GRAPH <{graph_uri!s}> {{ <{subject_uri!s}> {predicate} {object_uri} . {label_part} }}
}}
"""
print(query)
# print(query)
query_endpoint = SPARQLWrapper(f"{settings.sparql_endpoint}/update")
query_endpoint.setMethod("POST")
query_endpoint.setRequestMethod("urlencoded")
Expand Down Expand Up @@ -281,7 +281,8 @@ def load_cohort_dict_file(dict_path: str, cohort_id: str) -> Dataset:
detail="\n\n".join(errors),
)
except Exception as e:
print(e)
logging.warning(f"Error loading cohort {cohort_id}")
logging.warning(e)
raise HTTPException(
status_code=422,
detail=str(e)[5:],
Expand All @@ -298,7 +299,7 @@ def load_cohort_dict_file(dict_path: str, cohort_id: str) -> Dataset:
async def get_logs(
user: Any = Depends(get_current_user),
) -> list[str]:
"""Delete a cohort from the triplestore and delete its metadata file from the server."""
"""Get server logs (admins only)."""
user_email = user["email"]
if user_email not in settings.admins_list:
raise HTTPException(status_code=403, detail="You need to be admin to perform this action.")
Expand Down

0 comments on commit 824685e

Please sign in to comment.