Added debug logging to few key points.
This commit is contained in:
parent
a6d463da88
commit
865b0d225d
@ -94,6 +94,7 @@ class DocumentManager:
|
|||||||
|
|
||||||
def create_document(self, name: str, file_path: str) -> Optional[int]:
|
def create_document(self, name: str, file_path: str) -> Optional[int]:
|
||||||
"""Create a new document entry in the database."""
|
"""Create a new document entry in the database."""
|
||||||
|
logging.debug(f"** Creating new document entry to database")
|
||||||
now: str = datetime.now().isoformat()
|
now: str = datetime.now().isoformat()
|
||||||
self.db_manager.cursor.execute('''
|
self.db_manager.cursor.execute('''
|
||||||
INSERT INTO documents (name, file_path, added_timestamp) VALUES (?, ?, ?)
|
INSERT INTO documents (name, file_path, added_timestamp) VALUES (?, ?, ?)
|
||||||
@ -103,6 +104,7 @@ class DocumentManager:
|
|||||||
|
|
||||||
def update_document(self, document_id: int, name: Optional[str] = None, file_path: Optional[str] = None) -> None:
|
def update_document(self, document_id: int, name: Optional[str] = None, file_path: Optional[str] = None) -> None:
|
||||||
"""Update an existing document in the database."""
|
"""Update an existing document in the database."""
|
||||||
|
logging.debug(f"** Updating document, document_id: {document_id}")
|
||||||
now: str = datetime.now().isoformat()
|
now: str = datetime.now().isoformat()
|
||||||
if name:
|
if name:
|
||||||
self.db_manager.cursor.execute('''
|
self.db_manager.cursor.execute('''
|
||||||
@ -116,6 +118,7 @@ class DocumentManager:
|
|||||||
|
|
||||||
def soft_delete_document(self, document_id: int) -> None:
|
def soft_delete_document(self, document_id: int) -> None:
|
||||||
"""Soft delete a document by marking it as deleted in the database."""
|
"""Soft delete a document by marking it as deleted in the database."""
|
||||||
|
logging.debug(f"** This now soft deleted, document_id: {document_id}")
|
||||||
now: str = datetime.now().isoformat()
|
now: str = datetime.now().isoformat()
|
||||||
self.db_manager.cursor.execute('''
|
self.db_manager.cursor.execute('''
|
||||||
UPDATE documents SET isDeleted = 1, deleted_timestamp = ? WHERE id = ?
|
UPDATE documents SET isDeleted = 1, deleted_timestamp = ? WHERE id = ?
|
||||||
@ -167,7 +170,7 @@ class MarkdownProcessor:
|
|||||||
content_preview = ' '.join(token.content.split()[:10]) + '...' \
|
content_preview = ' '.join(token.content.split()[:10]) + '...' \
|
||||||
if len(token.content.split()) > 10 else token.content
|
if len(token.content.split()) > 10 else token.content
|
||||||
|
|
||||||
logging.debug(f"Processing token: {token.type}, content: {content_preview}")
|
#logging.debug(f"Processing token: {token.type}, content: {content_preview}")
|
||||||
if token.type == 'heading_open':
|
if token.type == 'heading_open':
|
||||||
level = int(token.tag.strip('h'))
|
level = int(token.tag.strip('h'))
|
||||||
content_token = tokens[tokens.index(token) + 1]
|
content_token = tokens[tokens.index(token) + 1]
|
||||||
@ -190,6 +193,7 @@ class MarkdownProcessor:
|
|||||||
|
|
||||||
def insert_heading(self, level: int, title: str, parent_id: Optional[int], document_id: int) -> int:
|
def insert_heading(self, level: int, title: str, parent_id: Optional[int], document_id: int) -> int:
|
||||||
"""Insert a heading into the database."""
|
"""Insert a heading into the database."""
|
||||||
|
logging.debug(f"Inserting title: {title} level: {level}")
|
||||||
self.db_manager.cursor.execute('''
|
self.db_manager.cursor.execute('''
|
||||||
INSERT INTO headings (level, title, parent_id, document_id)
|
INSERT INTO headings (level, title, parent_id, document_id)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
|
Loading…
Reference in New Issue
Block a user