mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
fix: use structlog not logging (#550)
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
"""Search functionality for transcripts and other entities."""
|
"""Search functionality for transcripts and other entities."""
|
||||||
|
|
||||||
import logging
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import Annotated, Any, Dict
|
from typing import Annotated, Any, Dict
|
||||||
@@ -12,8 +11,7 @@ from pydantic import BaseModel, Field, constr, field_serializer
|
|||||||
from reflector.db import get_database
|
from reflector.db import get_database
|
||||||
from reflector.db.transcripts import SourceKind, transcripts
|
from reflector.db.transcripts import SourceKind, transcripts
|
||||||
from reflector.db.utils import is_postgresql
|
from reflector.db.utils import is_postgresql
|
||||||
|
from reflector.logger import logger
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
DEFAULT_SEARCH_LIMIT = 20
|
DEFAULT_SEARCH_LIMIT = 20
|
||||||
SNIPPET_CONTEXT_LENGTH = 50 # Characters before/after match to include
|
SNIPPET_CONTEXT_LENGTH = 50 # Characters before/after match to include
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import enum
|
import enum
|
||||||
import json
|
import json
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
@@ -19,14 +18,13 @@ from reflector.db import get_database, metadata
|
|||||||
from reflector.db.recordings import recordings_controller
|
from reflector.db.recordings import recordings_controller
|
||||||
from reflector.db.rooms import rooms
|
from reflector.db.rooms import rooms
|
||||||
from reflector.db.utils import is_postgresql
|
from reflector.db.utils import is_postgresql
|
||||||
|
from reflector.logger import logger
|
||||||
from reflector.processors.types import Word as ProcessorWord
|
from reflector.processors.types import Word as ProcessorWord
|
||||||
from reflector.settings import settings
|
from reflector.settings import settings
|
||||||
from reflector.storage import get_recordings_storage, get_transcripts_storage
|
from reflector.storage import get_recordings_storage, get_transcripts_storage
|
||||||
from reflector.utils import generate_uuid4
|
from reflector.utils import generate_uuid4
|
||||||
from reflector.utils.webvtt import topics_to_webvtt
|
from reflector.utils.webvtt import topics_to_webvtt
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class SourceKind(enum.StrEnum):
|
class SourceKind(enum.StrEnum):
|
||||||
ROOM = enum.auto()
|
ROOM = enum.auto()
|
||||||
@@ -602,7 +600,7 @@ class TranscriptController:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Failed to delete transcript audio from storage",
|
"Failed to delete transcript audio from storage",
|
||||||
error=str(e),
|
exc_info=e,
|
||||||
transcript_id=transcript.id,
|
transcript_id=transcript.id,
|
||||||
)
|
)
|
||||||
transcript.unlink()
|
transcript.unlink()
|
||||||
@@ -617,14 +615,14 @@ class TranscriptController:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Failed to delete recording object from S3",
|
"Failed to delete recording object from S3",
|
||||||
error=str(e),
|
exc_info=e,
|
||||||
recording_id=transcript.recording_id,
|
recording_id=transcript.recording_id,
|
||||||
)
|
)
|
||||||
await recordings_controller.remove_by_id(transcript.recording_id)
|
await recordings_controller.remove_by_id(transcript.recording_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Failed to delete recording row",
|
"Failed to delete recording row",
|
||||||
error=str(e),
|
exc_info=e,
|
||||||
recording_id=transcript.recording_id,
|
recording_id=transcript.recording_id,
|
||||||
)
|
)
|
||||||
query = transcripts.delete().where(transcripts.c.id == transcript_id)
|
query = transcripts.delete().where(transcripts.c.id == transcript_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user