Logging Level Update (#2165)

This commit is contained in:
Yuhong Sun
2024-08-18 21:53:40 -07:00
committed by GitHub
parent 119aefba88
commit 5ab4d94d94
57 changed files with 183 additions and 201 deletions

View File

@@ -119,7 +119,7 @@ def _unsafe_deletion(
db_session.delete(connector)
db_session.commit()
logger.info(
logger.notice(
"Successfully deleted connector_credential_pair with connector_id:"
f" '{connector_id}' and credential_id: '{credential_id}'. Deleted {num_docs_deleted} docs."
)
@@ -133,10 +133,10 @@ def _delete_connector(cc_pair_id: int, db_session: Session) -> None:
Are you SURE you want to continue? (enter 'Y' to continue): "
)
if user_input != "Y":
logger.info(f"You entered {user_input}. Exiting!")
logger.notice(f"You entered {user_input}. Exiting!")
return
logger.info("Getting connector credential pair")
logger.notice("Getting connector credential pair")
cc_pair = get_connector_credential_pair_from_id(cc_pair_id, db_session)
if not cc_pair:
@@ -160,7 +160,7 @@ def _delete_connector(cc_pair_id: int, db_session: Session) -> None:
)
return
logger.info("Cancelling indexing attempt for the connector")
logger.notice("Cancelling indexing attempt for the connector")
cancel_indexing_attempts_for_ccpair(
cc_pair_id=cc_pair_id, db_session=db_session, include_secondary_index=True
)
@@ -183,7 +183,7 @@ def _delete_connector(cc_pair_id: int, db_session: Session) -> None:
else []
)
try:
logger.info("Deleting information from Vespa and Postgres")
logger.notice("Deleting information from Vespa and Postgres")
curr_ind_name, sec_ind_name = get_both_index_names(db_session)
document_index = get_default_document_index(
primary_index_name=curr_ind_name, secondary_index_name=sec_ind_name
@@ -195,16 +195,16 @@ def _delete_connector(cc_pair_id: int, db_session: Session) -> None:
cc_pair=cc_pair,
pair_id=cc_pair_id,
)
logger.info(f"Deleted {files_deleted_count} files!")
logger.notice(f"Deleted {files_deleted_count} files!")
except Exception as e:
logger.error(f"Failed to delete connector due to {e}")
if file_names:
logger.info("Deleting stored files!")
logger.notice("Deleting stored files!")
file_store = get_default_file_store(db_session)
for file_name in file_names:
logger.info(f"Deleting file {file_name}")
logger.notice(f"Deleting file {file_name}")
file_store.delete_file(file_name)

View File

@@ -21,7 +21,7 @@ logger = setup_logger()
def save_postgres(filename: str, container_name: str) -> None:
logger.info("Attempting to take Postgres snapshot")
logger.notice("Attempting to take Postgres snapshot")
cmd = f"docker exec {container_name} pg_dump -U {POSTGRES_USER} -h {POSTGRES_HOST} -p {POSTGRES_PORT} -W -F t {POSTGRES_DB}"
with open(filename, "w") as file:
subprocess.run(
@@ -35,7 +35,7 @@ def save_postgres(filename: str, container_name: str) -> None:
def load_postgres(filename: str, container_name: str) -> None:
logger.info("Attempting to load Postgres snapshot")
logger.notice("Attempting to load Postgres snapshot")
try:
alembic_cfg = Config("alembic.ini")
command.upgrade(alembic_cfg, "head")
@@ -57,7 +57,7 @@ def load_postgres(filename: str, container_name: str) -> None:
def save_vespa(filename: str) -> None:
logger.info("Attempting to take Vespa snapshot")
logger.notice("Attempting to take Vespa snapshot")
continuation = ""
params = {}
doc_jsons: list[dict] = []