mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
chore: remove logfire
Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
"""basic-memory - Local-first knowledge management combining Zettelkasten with knowledge graphs"""
|
||||
|
||||
# Set this at the package level to ensure it's set before any modules import logfire
|
||||
import os
|
||||
|
||||
os.environ["LOGFIRE_IGNORE_NO_CONFIG"] = "1"
|
||||
|
||||
__version__ = "0.8.0"
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
"""FastAPI application for basic-memory knowledge graph API."""
|
||||
|
||||
# Suppress logfire warnings
|
||||
import os
|
||||
|
||||
os.environ["LOGFIRE_IGNORE_NO_CONFIG"] = "1"
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
import logfire
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi.exception_handlers import http_exception_handler
|
||||
from loguru import logger
|
||||
@@ -34,9 +28,6 @@ app = FastAPI(
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
if app_config != "test":
|
||||
logfire.instrument_fastapi(app)
|
||||
|
||||
|
||||
# Include routers
|
||||
app.include_router(knowledge.router)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Database management commands."""
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
|
||||
@@ -8,7 +7,6 @@ from basic_memory.alembic import migrations
|
||||
from basic_memory.cli.app import app
|
||||
|
||||
|
||||
@logfire.instrument()
|
||||
@app.command()
|
||||
def reset(
|
||||
reindex: bool = typer.Option(False, "--reindex", help="Rebuild db index from filesystem"),
|
||||
|
||||
@@ -6,7 +6,6 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Annotated, Set, Optional
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
from rich.console import Console
|
||||
@@ -208,7 +207,6 @@ async def get_markdown_processor() -> MarkdownProcessor:
|
||||
|
||||
|
||||
@import_app.command(name="chatgpt", help="Import conversations from ChatGPT JSON export.")
|
||||
@logfire.instrument(extract_args=False)
|
||||
def import_chatgpt(
|
||||
conversations_json: Annotated[
|
||||
Path, typer.Argument(help="Path to ChatGPT conversations.json file")
|
||||
|
||||
@@ -6,7 +6,6 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Annotated
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
from rich.console import Console
|
||||
@@ -161,7 +160,6 @@ async def get_markdown_processor() -> MarkdownProcessor:
|
||||
|
||||
|
||||
@claude_app.command(name="conversations", help="Import chat conversations from Claude.ai.")
|
||||
@logfire.instrument(extract_args=False)
|
||||
def import_claude(
|
||||
conversations_json: Annotated[
|
||||
Path, typer.Argument(..., help="Path to conversations.json file")
|
||||
|
||||
@@ -5,7 +5,6 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, Annotated, Optional
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
from rich.console import Console
|
||||
@@ -144,7 +143,6 @@ async def get_markdown_processor() -> MarkdownProcessor:
|
||||
|
||||
|
||||
@claude_app.command(name="projects", help="Import projects from Claude.ai.")
|
||||
@logfire.instrument(extract_args=False)
|
||||
def import_projects(
|
||||
projects_json: Annotated[Path, typer.Argument(..., help="Path to projects.json file")] = Path(
|
||||
"projects.json"
|
||||
|
||||
@@ -5,7 +5,6 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Annotated
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
from rich.console import Console
|
||||
@@ -99,7 +98,6 @@ async def get_markdown_processor() -> MarkdownProcessor:
|
||||
|
||||
|
||||
@import_app.command()
|
||||
@logfire.instrument(extract_args=False)
|
||||
def memory_json(
|
||||
json_path: Annotated[Path, typer.Argument(..., help="Path to memory.json file")] = Path(
|
||||
"memory.json"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import asyncio
|
||||
from typing import Set, Dict
|
||||
|
||||
import logfire
|
||||
import typer
|
||||
from loguru import logger
|
||||
from rich.console import Console
|
||||
@@ -130,7 +129,6 @@ async def run_status(sync_service: SyncService, verbose: bool = False):
|
||||
|
||||
|
||||
@app.command()
|
||||
@logfire.instrument(extract_args=False)
|
||||
def status(
|
||||
verbose: bool = typer.Option(False, "--verbose", "-v", help="Show detailed file information"),
|
||||
):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
import logfire
|
||||
from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import (
|
||||
AsyncSession,
|
||||
@@ -46,8 +45,6 @@ async def get_engine_factory(
|
||||
) -> tuple[AsyncEngine, async_sessionmaker[AsyncSession]]: # pragma: no cover
|
||||
"""Get engine and session maker."""
|
||||
engine, session_maker = await db.get_or_create_db(project_config.database_path)
|
||||
if project_config.env != "test":
|
||||
logfire.instrument_sqlalchemy(engine=engine)
|
||||
return engine, session_maker
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.server import mcp
|
||||
@@ -11,7 +10,6 @@ from basic_memory.mcp.server import mcp
|
||||
name="ai assistant guide",
|
||||
description="Give an AI assistant guidance on how to use Basic Memory tools effectively",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
def ai_assistant_guide() -> str:
|
||||
"""Return a concise guide on Basic Memory tools and how to use them.
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from textwrap import dedent
|
||||
from typing import Optional, Annotated
|
||||
|
||||
from loguru import logger
|
||||
import logfire
|
||||
from pydantic import Field
|
||||
|
||||
from basic_memory.mcp.prompts.utils import format_prompt_context, PromptContext, PromptContextItem
|
||||
@@ -25,7 +24,6 @@ from basic_memory.schemas.search import SearchQuery, SearchItemType
|
||||
name="Continue Conversation",
|
||||
description="Continue a previous conversation",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def continue_conversation(
|
||||
topic: Annotated[Optional[str], Field(description="Topic or keyword to search for")] = None,
|
||||
timeframe: Annotated[
|
||||
|
||||
@@ -6,7 +6,6 @@ These prompts help users see what has changed in their knowledge base recently.
|
||||
from typing import Annotated
|
||||
|
||||
from loguru import logger
|
||||
import logfire
|
||||
from pydantic import Field
|
||||
|
||||
from basic_memory.mcp.prompts.utils import format_prompt_context, PromptContext, PromptContextItem
|
||||
@@ -20,7 +19,6 @@ from basic_memory.schemas.search import SearchItemType
|
||||
name="Share Recent Activity",
|
||||
description="Get recent activity from across the knowledge base",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def recent_activity_prompt(
|
||||
timeframe: Annotated[
|
||||
TimeFrame,
|
||||
|
||||
@@ -7,20 +7,18 @@ from textwrap import dedent
|
||||
from typing import Annotated, Optional
|
||||
|
||||
from loguru import logger
|
||||
import logfire
|
||||
from pydantic import Field
|
||||
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.tools.search import search as search_tool
|
||||
from basic_memory.schemas.search import SearchQuery, SearchResponse
|
||||
from basic_memory.schemas.base import TimeFrame
|
||||
from basic_memory.schemas.search import SearchQuery, SearchResponse
|
||||
|
||||
|
||||
@mcp.prompt(
|
||||
name="Search Knowledge Base",
|
||||
description="Search across all content in basic-memory",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def search_prompt(
|
||||
query: str,
|
||||
timeframe: Annotated[
|
||||
|
||||
@@ -2,22 +2,20 @@
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.async_client import client
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.tools.utils import call_get
|
||||
from basic_memory.schemas.base import TimeFrame
|
||||
from basic_memory.schemas.memory import (
|
||||
GraphContext,
|
||||
MemoryUrl,
|
||||
memory_url_path,
|
||||
normalize_memory_url,
|
||||
)
|
||||
from basic_memory.schemas.base import TimeFrame
|
||||
|
||||
|
||||
@logfire.instrument(extract_args=False)
|
||||
@mcp.tool(
|
||||
description="""Build context from a memory:// URI to continue conversations naturally.
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ This tool creates Obsidian canvas files (.canvas) using the JSON Canvas 1.0 spec
|
||||
import json
|
||||
from typing import Dict, List, Any
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.async_client import client
|
||||
@@ -17,7 +16,6 @@ from basic_memory.mcp.tools.utils import call_put
|
||||
@mcp.tool(
|
||||
description="Create an Obsidian canvas file to visualize concepts and connections.",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def canvas(
|
||||
nodes: List[Dict[str, Any]],
|
||||
edges: List[Dict[str, Any]],
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import logfire
|
||||
|
||||
from basic_memory.mcp.tools.utils import call_delete
|
||||
|
||||
|
||||
@@ -9,7 +7,6 @@ from basic_memory.schemas import DeleteEntitiesResponse
|
||||
|
||||
|
||||
@mcp.tool(description="Delete a note by title or permalink")
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def delete_note(identifier: str) -> bool:
|
||||
"""Delete a note from the knowledge base.
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
"""Project info tool for Basic Memory MCP server."""
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.async_client import client
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.tools.utils import call_get
|
||||
from basic_memory.schemas import ProjectInfoResponse
|
||||
from basic_memory.mcp.async_client import client
|
||||
|
||||
|
||||
@mcp.tool(
|
||||
description="Get information and statistics about the current Basic Memory project.",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def project_info() -> ProjectInfoResponse:
|
||||
"""Get comprehensive information about the current Basic Memory project.
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from textwrap import dedent
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.async_client import client
|
||||
@@ -16,7 +15,6 @@ from basic_memory.schemas.search import SearchQuery
|
||||
@mcp.tool(
|
||||
description="Read a markdown note by title or permalink.",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def read_note(identifier: str, page: int = 1, page_size: int = 10) -> str:
|
||||
"""Read a markdown note from the knowledge base.
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
from typing import Optional, List
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.async_client import client
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.tools.utils import call_get
|
||||
from basic_memory.schemas.memory import GraphContext
|
||||
from basic_memory.schemas.base import TimeFrame
|
||||
from basic_memory.schemas.memory import GraphContext
|
||||
from basic_memory.schemas.search import SearchItemType
|
||||
|
||||
|
||||
@@ -25,7 +24,6 @@ from basic_memory.schemas.search import SearchItemType
|
||||
Or standard formats like "7d"
|
||||
""",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def recent_activity(
|
||||
type: Optional[List[SearchItemType]] = None,
|
||||
depth: Optional[int] = 1,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Search tools for Basic Memory MCP server."""
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.server import mcp
|
||||
@@ -9,7 +8,6 @@ from basic_memory.schemas.search import SearchQuery, SearchResponse
|
||||
from basic_memory.mcp.async_client import client
|
||||
|
||||
|
||||
@logfire.instrument(extract_args=False)
|
||||
@mcp.tool(
|
||||
description="Search across all content in basic-memory, including documents and entities",
|
||||
)
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
|
||||
from typing import Optional, List
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.async_client import client
|
||||
from basic_memory.schemas.base import Entity
|
||||
from basic_memory.schemas import EntityResponse
|
||||
from basic_memory.mcp.server import mcp
|
||||
from basic_memory.mcp.tools.utils import call_put
|
||||
from basic_memory.schemas import EntityResponse
|
||||
from basic_memory.schemas.base import Entity
|
||||
|
||||
|
||||
@mcp.tool(
|
||||
description="Create or update a markdown note. Returns a markdown formatted summary of the semantic content.",
|
||||
)
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def write_note(
|
||||
title: str,
|
||||
content: str,
|
||||
|
||||
@@ -40,10 +40,10 @@ class SearchService:
|
||||
|
||||
async def reindex_all(self, background_tasks: Optional[BackgroundTasks] = None) -> None:
|
||||
"""Reindex all content from database."""
|
||||
|
||||
|
||||
logger.info("Starting full reindex")
|
||||
# Clear and recreate search index
|
||||
await self.repository.execute_query(text("DROP TABLE IF EXISTS search_index"), params=None)
|
||||
await self.repository.execute_query(text("DROP TABLE IF EXISTS search_index"), params={})
|
||||
await self.init_search_index()
|
||||
|
||||
# Reindex all entities
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
"""Service for syncing files between filesystem and database."""
|
||||
|
||||
# Suppress logfire warnings
|
||||
import os
|
||||
|
||||
os.environ["LOGFIRE_IGNORE_NO_CONFIG"] = "1"
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import field
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, Set, Tuple
|
||||
|
||||
import logfire
|
||||
from loguru import logger
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
@@ -20,6 +16,8 @@ from basic_memory.models import Entity
|
||||
from basic_memory.repository import EntityRepository, RelationRepository
|
||||
from basic_memory.services import EntityService, FileService
|
||||
from basic_memory.services.search_service import SearchService
|
||||
import time
|
||||
from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -81,11 +79,8 @@ class SyncService:
|
||||
self.search_service = search_service
|
||||
self.file_service = file_service
|
||||
|
||||
@logfire.instrument(extract_args=False)
|
||||
async def sync(self, directory: Path, show_progress: bool = True) -> SyncReport:
|
||||
"""Sync all files with database."""
|
||||
import time
|
||||
from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn
|
||||
|
||||
start_time = time.time()
|
||||
console = None
|
||||
@@ -129,64 +124,64 @@ class SyncService:
|
||||
if report.moves: # pragma: no cover
|
||||
move_task = progress.add_task("[blue]Moving files...", total=len(report.moves)) # pyright: ignore
|
||||
|
||||
delete_task = None
|
||||
if report.deleted: # pragma: no cover
|
||||
delete_task = progress.add_task( # pyright: ignore
|
||||
"[red]Deleting files...", total=len(report.deleted)
|
||||
delete_task = None
|
||||
if report.deleted: # pragma: no cover
|
||||
delete_task = progress.add_task( # pyright: ignore
|
||||
"[red]Deleting files...", total=len(report.deleted)
|
||||
)
|
||||
|
||||
new_task = None
|
||||
if report.new:
|
||||
new_task = progress.add_task( # pyright: ignore
|
||||
"[green]Adding new files...", total=len(report.new)
|
||||
)
|
||||
|
||||
modify_task = None
|
||||
if report.modified: # pragma: no cover
|
||||
modify_task = progress.add_task( # pyright: ignore
|
||||
"[yellow]Updating modified files...", total=len(report.modified)
|
||||
)
|
||||
|
||||
# sync moves first
|
||||
for i, (old_path, new_path) in enumerate(report.moves.items()):
|
||||
# in the case where a file has been deleted and replaced by another file
|
||||
# it will show up in the move and modified lists, so handle it in modified
|
||||
if new_path in report.modified: # pragma: no cover
|
||||
report.modified.remove(new_path)
|
||||
logger.debug(
|
||||
"File marked as moved and modified",
|
||||
old_path=old_path,
|
||||
new_path=new_path,
|
||||
action="processing as modified",
|
||||
)
|
||||
else: # pragma: no cover
|
||||
await self.handle_move(old_path, new_path)
|
||||
|
||||
new_task = None
|
||||
if report.new:
|
||||
new_task = progress.add_task( # pyright: ignore
|
||||
"[green]Adding new files...", total=len(report.new)
|
||||
)
|
||||
if move_task is not None: # pragma: no cover
|
||||
progress.update(move_task, advance=1) # pyright: ignore
|
||||
|
||||
modify_task = None
|
||||
if report.modified: # pragma: no cover
|
||||
modify_task = progress.add_task( # pyright: ignore
|
||||
"[yellow]Updating modified files...", total=len(report.modified)
|
||||
)
|
||||
# deleted next
|
||||
for i, path in enumerate(report.deleted): # pragma: no cover
|
||||
await self.handle_delete(path)
|
||||
if delete_task is not None: # pragma: no cover
|
||||
progress.update(delete_task, advance=1) # pyright: ignore
|
||||
|
||||
# sync moves first
|
||||
for i, (old_path, new_path) in enumerate(report.moves.items()):
|
||||
# in the case where a file has been deleted and replaced by another file
|
||||
# it will show up in the move and modified lists, so handle it in modified
|
||||
if new_path in report.modified: # pragma: no cover
|
||||
report.modified.remove(new_path)
|
||||
logger.debug(
|
||||
"File marked as moved and modified",
|
||||
old_path=old_path,
|
||||
new_path=new_path,
|
||||
action="processing as modified",
|
||||
)
|
||||
else: # pragma: no cover
|
||||
await self.handle_move(old_path, new_path)
|
||||
# then new and modified
|
||||
for i, path in enumerate(report.new):
|
||||
await self.sync_file(path, new=True)
|
||||
if new_task is not None:
|
||||
progress.update(new_task, advance=1) # pyright: ignore
|
||||
|
||||
if move_task is not None: # pragma: no cover
|
||||
progress.update(move_task, advance=1) # pyright: ignore
|
||||
for i, path in enumerate(report.modified): # pragma: no cover
|
||||
await self.sync_file(path, new=False)
|
||||
if modify_task is not None: # pragma: no cover
|
||||
progress.update(modify_task, advance=1) # pyright: ignore
|
||||
|
||||
# deleted next
|
||||
for i, path in enumerate(report.deleted): # pragma: no cover
|
||||
await self.handle_delete(path)
|
||||
if delete_task is not None: # pragma: no cover
|
||||
progress.update(delete_task, advance=1) # pyright: ignore
|
||||
|
||||
# then new and modified
|
||||
for i, path in enumerate(report.new):
|
||||
await self.sync_file(path, new=True)
|
||||
if new_task is not None:
|
||||
progress.update(new_task, advance=1) # pyright: ignore
|
||||
|
||||
for i, path in enumerate(report.modified): # pragma: no cover
|
||||
await self.sync_file(path, new=False)
|
||||
if modify_task is not None: # pragma: no cover
|
||||
progress.update(modify_task, advance=1) # pyright: ignore
|
||||
|
||||
# Final step - resolving relations
|
||||
if report.total > 0:
|
||||
relation_task = progress.add_task("[cyan]Resolving relations...", total=1) # pyright: ignore
|
||||
await self.resolve_relations()
|
||||
progress.update(relation_task, advance=1) # pyright: ignore
|
||||
# Final step - resolving relations
|
||||
if report.total > 0:
|
||||
relation_task = progress.add_task("[cyan]Resolving relations...", total=1) # pyright: ignore
|
||||
await self.resolve_relations()
|
||||
progress.update(relation_task, advance=1) # pyright: ignore
|
||||
else:
|
||||
# No progress display - proceed with normal sync
|
||||
# sync moves first
|
||||
@@ -552,8 +547,6 @@ class SyncService:
|
||||
Returns:
|
||||
ScanResult containing found files and any errors
|
||||
"""
|
||||
import time
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
logger.debug("Scanning directory", directory=str(directory))
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
"""Utility functions for basic-memory."""
|
||||
|
||||
# Set environment variable before importing logfire to suppress warnings
|
||||
import os
|
||||
|
||||
os.environ["LOGFIRE_IGNORE_NO_CONFIG"] = "1"
|
||||
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
@@ -14,9 +11,6 @@ from typing import Optional, Protocol, Union, runtime_checkable
|
||||
from loguru import logger
|
||||
from unidecode import unidecode
|
||||
|
||||
import basic_memory
|
||||
import logfire
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class PathLike(Protocol):
|
||||
@@ -104,26 +98,6 @@ def setup_logging(
|
||||
|
||||
# Add file handler if we are not running tests and a log file is specified
|
||||
if log_file and env != "test":
|
||||
try:
|
||||
# Only configure logfire if API key is set - avoids interactive prompts
|
||||
if "LOGFIRE_TOKEN" in os.environ:
|
||||
# Configure logfire with code source info
|
||||
logfire.configure(
|
||||
code_source=logfire.CodeSource(
|
||||
repository="https://github.com/basicmachines-co/basic-memory",
|
||||
revision=f"v{basic_memory.__version__}" if env != "dev" else "HEAD",
|
||||
),
|
||||
environment=env,
|
||||
console=False,
|
||||
)
|
||||
logger.configure(handlers=[logfire.loguru_handler()])
|
||||
|
||||
# Instrument code spans for better observability
|
||||
logfire.instrument_sqlite3()
|
||||
logfire.instrument_httpx()
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to configure logfire: {e}")
|
||||
|
||||
# Setup file logger
|
||||
log_path = home_dir / log_file
|
||||
logger.add(
|
||||
@@ -149,12 +123,6 @@ def setup_logging(
|
||||
"httpx": logging.WARNING,
|
||||
# File watching logs
|
||||
"watchfiles.main": logging.WARNING,
|
||||
# Instrumentation noise
|
||||
"instrumentor": logging.ERROR,
|
||||
"opentelemetry.instrumentation.instrumentor": logging.ERROR,
|
||||
"opentelemetry.instrumentation": logging.ERROR,
|
||||
"logfire.instrumentor": logging.ERROR,
|
||||
"opentelemetry.sdk.metrics._internal.instrument": logging.ERROR,
|
||||
}
|
||||
|
||||
# Set log levels for noisy loggers
|
||||
|
||||
Reference in New Issue
Block a user