The log format of the central storage has been adjusted so that it can actively write corresponding logs to the log files.
Simultaneously upgraded the mirror versions of authentication and central storage.
This commit is contained in:
parent
24fe043fc3
commit
5f8b6ed575
@ -1,4 +1,4 @@
|
||||
FROM python:3.10-slim-bullseye
|
||||
FROM python:3.12-slim
|
||||
|
||||
# docker settings
|
||||
ARG CONTAINER_APP_ROOT="/app"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM python:3.10-slim-buster
|
||||
FROM python:3.12-slim
|
||||
|
||||
# docker settings
|
||||
ARG CONTAINER_APP_ROOT="/app"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from backend.business.document_manager import (
|
||||
DocumentManager,
|
||||
)
|
||||
from common.log.module_logger import ModuleLogger
|
||||
|
||||
|
||||
class DocumentHub:
|
||||
@ -8,15 +9,22 @@ class DocumentHub:
|
||||
self,
|
||||
):
|
||||
self.document_manager = DocumentManager()
|
||||
self.module_logger = ModuleLogger(sender_id="DocumentHub")
|
||||
return
|
||||
|
||||
async def retrieve_document_info(self, document_id: str):
|
||||
return await self.document_manager.retrieve_document_info(document_id)
|
||||
await self.module_logger.log_info(f"Retrieving document info for ID: {document_id}")
|
||||
result = await self.document_manager.retrieve_document_info(document_id)
|
||||
await self.module_logger.log_info(f"Document info retrieved successfully for ID: {document_id}")
|
||||
return result
|
||||
|
||||
async def read_document_file_as_http_media_data(self, document_id: str):
|
||||
return await self.document_manager.read_document_file_as_http_media_data(
|
||||
await self.module_logger.log_info(f"Reading document as HTTP media for ID: {document_id}")
|
||||
result = await self.document_manager.read_document_file_as_http_media_data(
|
||||
document_id
|
||||
)
|
||||
await self.module_logger.log_info(f"Document media data read successfully for ID: {document_id}")
|
||||
return result
|
||||
|
||||
async def upload_document(
|
||||
self, associated_with: str, file_name: str, file_data: bytes
|
||||
@ -26,11 +34,16 @@ class DocumentHub:
|
||||
file_name: the name of the file
|
||||
file (bytes): the file to be uploaded
|
||||
"""
|
||||
return await self.document_manager.upload_file(
|
||||
await self.module_logger.log_info(f"Uploading document {file_name} for user {associated_with}")
|
||||
result = await self.document_manager.upload_file(
|
||||
associated_with, file_name, file_data
|
||||
)
|
||||
await self.module_logger.log_info(f"Document upload completed for {file_name}, result: {result}")
|
||||
return result
|
||||
|
||||
async def delete_documents(self, document_ids: list):
|
||||
await self.module_logger.log_info(f"Deleting documents: {document_ids}")
|
||||
for document_id in document_ids:
|
||||
await self.document_manager.delete_document(document_id)
|
||||
await self.module_logger.log_info(f"Documents deleted successfully: {document_ids}")
|
||||
return
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
from backend.services.document_service import DocumentService
|
||||
from backend.models.models import MediaType, DataFormat
|
||||
from common.log.module_logger import ModuleLogger
|
||||
|
||||
|
||||
class DocumentManager:
|
||||
def __init__(self) -> None:
|
||||
self.document_service = DocumentService()
|
||||
self.module_logger = ModuleLogger(sender_id="DocumentManager")
|
||||
|
||||
async def retrieve_document_info(self, document_id: str):
|
||||
await self.document_service.load_document(document_id=document_id)
|
||||
|
||||
@ -12,6 +12,7 @@ from webapi.providers import probes
|
||||
from webapi.providers import metrics
|
||||
from .freeleaps_app import FreeleapsApp
|
||||
from common.config.app_settings import app_settings
|
||||
from common.log.module_logger import ModuleLogger
|
||||
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
@ -20,6 +21,10 @@ def create_app() -> FastAPI:
|
||||
app = FreeleapsApp()
|
||||
|
||||
register_logger()
|
||||
|
||||
# Create application logger for startup logging
|
||||
app_logger = ModuleLogger(sender_id="ApplicationBootstrap")
|
||||
|
||||
register(app, exception_handler)
|
||||
register(app, database)
|
||||
register(app, router)
|
||||
@ -37,6 +42,14 @@ def create_app() -> FastAPI:
|
||||
if app_settings.METRICS_ENABLED:
|
||||
register(app, metrics)
|
||||
|
||||
# Log application startup completion
|
||||
import asyncio
|
||||
async def log_startup():
|
||||
await app_logger.log_info("Central Storage application initialized successfully")
|
||||
|
||||
# Run the async logging
|
||||
asyncio.create_task(log_startup())
|
||||
|
||||
return app
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user