Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2059371
Implement centralized logging system using Loguru for PictoPy project
Hemil36 Oct 1, 2025
145dc11
Copilot/vscode1759322757618 (#2)
Hemil36 Oct 1, 2025
87d8598
Merge branch 'AOSSIE-Org:main' into logging
Hemil36 Oct 1, 2025
c6cec0a
Refactor function signatures for improved readability and consistency…
Hemil36 Oct 1, 2025
e17e9eb
Refactor ObjectClassifier and YOLO classes to use logging instead of …
Hemil36 Oct 1, 2025
b6440f1
Refactor YOLO and ObjectClassifier classes for improved readability b…
Hemil36 Oct 1, 2025
10df1a6
Add loguru to sync-microservice requirements for enhanced logging cap…
Hemil36 Oct 1, 2025
71b8da7
add LoggerWriter class for stdout/stderr redirection to logging system
Hemil36 Oct 1, 2025
c91939b
Remove unused import statements from folders.py and microservice.py f…
Hemil36 Oct 1, 2025
0eba7a0
Implement log thread cleanup and enhance stdout/stderr redirection in…
Hemil36 Oct 1, 2025
5a8b7d1
Remove unused import statement for os in yolo_mapping.py
Hemil36 Oct 1, 2025
26b4590
fix: Renamed File image_matatdata.py
Hemil36 Oct 3, 2025
22a074a
Merge branch 'main' into logging
Hemil36 Oct 3, 2025
4d51dbb
Merge branch 'main' into logging
Hemil36 Oct 13, 2025
a16268f
Add requirements.txt with project dependencies
Hemil36 Oct 13, 2025
7747497
Merge branch 'main' into logging
Hemil36 Oct 19, 2025
e397958
Refactor logging statements for consistency and clarity
Hemil36 Oct 19, 2025
2647b64
Change log output from logger to print in stream_logs function
Hemil36 Oct 19, 2025
e25d147
Refactor logging statements for consistency and clarity in microservi…
Hemil36 Oct 19, 2025
2ad562d
Enhance logging configuration for watchfiles and update logger levels…
Hemil36 Oct 19, 2025
7efeceb
Refactor logging setup and add debug change formatting utility for im…
Hemil36 Oct 19, 2025
68ec85c
Fix formatting error message in watcher_helpers.py
Hemil36 Oct 19, 2025
9c49726
Fix formatting in watcher_helpers.py
Hemil36 Oct 19, 2025
63c70d0
Refactor format_debug_changes function for improved error handling an…
Hemil36 Oct 19, 2025
e597f9a
Update logging levels for watchfiles to INFO for improved visibility
Hemil36 Oct 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/app/database/face_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def db_delete_all_clusters() -> int:
return deleted_count


def db_get_all_clusters_with_face_counts() -> List[
Dict[str, Union[str, Optional[str], int]]
]:
def db_get_all_clusters_with_face_counts() -> (
List[Dict[str, Union[str, Optional[str], int]]]
):
"""
Retrieve all clusters with their face counts and stored face images.

Expand Down
8 changes: 4 additions & 4 deletions backend/app/database/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def db_get_faces_unassigned_clusters() -> List[Dict[str, Union[FaceId, FaceEmbed
return faces


def db_get_all_faces_with_cluster_names() -> List[
Dict[str, Union[FaceId, FaceEmbedding, Optional[str]]]
]:
def db_get_all_faces_with_cluster_names() -> (
List[Dict[str, Union[FaceId, FaceEmbedding, Optional[str]]]]
):
"""
Get all faces with their corresponding cluster names.

Expand Down Expand Up @@ -271,7 +271,7 @@ def db_get_all_faces_with_cluster_names() -> List[


def db_update_face_cluster_ids_batch(
face_cluster_mapping: List[Dict[str, Union[FaceId, ClusterId]]]
face_cluster_mapping: List[Dict[str, Union[FaceId, ClusterId]]],
) -> None:
"""
Update cluster IDs for multiple faces in batch.
Expand Down
6 changes: 3 additions & 3 deletions backend/app/database/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ def db_get_folder_ids_by_paths(
conn.close()


def db_get_all_folder_details() -> List[
Tuple[str, str, Optional[str], int, bool, Optional[bool]]
]:
def db_get_all_folder_details() -> (
List[Tuple[str, str, Optional[str], int, bool, Optional[bool]]]
):
"""
Get all folder details including folder_id, folder_path, parent_folder_id,
last_modified_time, AI_Tagging, and taggingCompleted.
Expand Down
18 changes: 11 additions & 7 deletions backend/app/database/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from app.config.settings import (
DATABASE_PATH,
)
from app.logging.setup_logging import get_logger

# Initialize logger
logger = get_logger(__name__)

# Type definitions
ImageId = str
Expand Down Expand Up @@ -108,7 +112,7 @@ def db_bulk_insert_images(image_records: List[ImageRecord]) -> bool:
conn.commit()
return True
except Exception as e:
print(f"Error inserting image records: {e}")
logger.error(f"Error inserting image records: {e}")
Comment thread
Hemil36 marked this conversation as resolved.
conn.rollback()
return False
finally:
Expand Down Expand Up @@ -189,7 +193,7 @@ def db_get_all_images() -> List[dict]:
return images

except Exception as e:
print(f"Error getting all images: {e}")
logger.error(f"Error getting all images: {e}")
return []
finally:
conn.close()
Expand Down Expand Up @@ -264,7 +268,7 @@ def db_update_image_tagged_status(image_id: ImageId, is_tagged: bool = True) ->
conn.commit()
return cursor.rowcount > 0
except Exception as e:
print(f"Error updating image tagged status: {e}")
logger.error(f"Error updating image tagged status: {e}")
conn.rollback()
return False
finally:
Expand Down Expand Up @@ -298,7 +302,7 @@ def db_insert_image_classes_batch(image_class_pairs: List[ImageClassPair]) -> bo
conn.commit()
return True
except Exception as e:
print(f"Error inserting image classes: {e}")
logger.error(f"Error inserting image classes: {e}")
conn.rollback()
return False
finally:
Expand Down Expand Up @@ -336,7 +340,7 @@ def db_get_images_by_folder_ids(
)
return cursor.fetchall()
except Exception as e:
print(f"Error getting images by folder IDs: {e}")
logger.error(f"Error getting images by folder IDs: {e}")
return []
finally:
conn.close()
Expand Down Expand Up @@ -367,10 +371,10 @@ def db_delete_images_by_ids(image_ids: List[ImageId]) -> bool:
image_ids,
)
conn.commit()
print(f"Deleted {cursor.rowcount} obsolete image(s) from database")
logger.info(f"Deleted {cursor.rowcount} obsolete image(s) from database")
return True
except Exception as e:
print(f"Error deleting images: {e}")
logger.error(f"Error deleting images: {e}")
conn.rollback()
return False
finally:
Expand Down
2 changes: 0 additions & 2 deletions backend/app/database/yolo_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

def db_create_YOLO_classes_table():
# print current directory:
import os

print(os.getcwd())
conn = sqlite3.connect(DATABASE_PATH)
cursor = conn.cursor()

Expand Down
9 changes: 9 additions & 0 deletions backend/app/logging/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
__init__.py for the backend.app.logging package.

This file allows the package to be imported and initializes logging.
"""

from .setup_logging import get_logger, configure_uvicorn_logging, setup_logging

__all__ = ["get_logger", "configure_uvicorn_logging", "setup_logging"]
Loading
Loading