write logs for inference and loader to file

This commit is contained in:
Alex Bezdieniezhnykh
2025-06-14 16:08:32 +03:00
parent 8aa2f563a4
commit 6f297c4ebf
30 changed files with 218 additions and 140 deletions
+3 -3
View File
@@ -47,7 +47,7 @@ cdef class ApiClient:
token = response.json()["token"]
self.set_token(token)
except HTTPError as e:
constants.log(response.json())
constants.logerror(response.json())
if response.status_code == HTTPStatus.CONFLICT:
res = response.json()
raise Exception(res['Message'])
@@ -95,7 +95,7 @@ cdef class ApiClient:
r.raise_for_status()
constants.log(f"Uploaded {filename} to {self.api_url}/{folder} successfully: {r.status_code}.")
except Exception as e:
constants.log(f"Upload fail: {e}")
constants.logerror(f"Upload fail: {e}")
cdef list_files(self, str folder, str search_file):
response = self.request('get', f'{self.api_url}/resources/list/{folder}', {
@@ -173,7 +173,7 @@ cdef class ApiClient:
resource = Security.decrypt_to(encrypted_bytes_small + local_bytes_big, key)
return resource
except Exception as ex:
constants.log('Local file {folder}\\{big_part} doesnt match with api file, old version')
constants.logerror('Local file {folder}\\{big_part} doesnt match with api file, old version')
remote_bytes_big = self.load_big_file_cdn(folder, big_part)
return Security.decrypt_to(encrypted_bytes_small + remote_bytes_big, key)