This commit introduces the foundational elements for the new "Company Explorer" web application, marking a significant step away from the legacy Google Sheets / CLI system. Key changes include: - Project Structure: A new directory with separate (FastAPI) and (React/Vite) components. - Data Persistence: Migration from Google Sheets to a local SQLite database () using SQLAlchemy. - Core Utilities: Extraction and cleanup of essential helper functions (LLM wrappers, text utilities) into . - Backend Services: , , for AI-powered analysis, and logic. - Frontend UI: Basic React application with company table, import wizard, and dynamic inspector sidebar. - Docker Integration: Updated and for multi-stage builds and sideloading. - Deployment & Access: Integrated into central Nginx proxy and dashboard, accessible via . Lessons Learned & Fixed during development: - Frontend Asset Loading: Addressed issues with Vite's path and FastAPI's . - TypeScript Configuration: Added and . - Database Schema Evolution: Solved errors by forcing a new database file and correcting override. - Logging: Implemented robust file-based logging (). This new foundation provides a powerful and maintainable platform for future B2B robotics lead generation.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
import logging
|
|
import sys
|
|
import os
|
|
from logging.handlers import RotatingFileHandler
|
|
from ..config import settings
|
|
|
|
def setup_logging():
|
|
log_file = os.path.join(settings.LOG_DIR, "company_explorer_debug.log")
|
|
|
|
# Create Formatter
|
|
formatter = logging.Formatter(
|
|
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
)
|
|
|
|
# File Handler
|
|
try:
|
|
file_handler = RotatingFileHandler(log_file, maxBytes=10*1024*1024, backupCount=5)
|
|
file_handler.setFormatter(formatter)
|
|
file_handler.setLevel(logging.DEBUG)
|
|
except Exception as e:
|
|
print(f"FATAL: Could not create log file at {log_file}: {e}")
|
|
return
|
|
|
|
# Console Handler
|
|
console_handler = logging.StreamHandler(sys.stdout)
|
|
console_handler.setFormatter(formatter)
|
|
console_handler.setLevel(logging.INFO) # Keep console clean
|
|
|
|
# Root Logger Config
|
|
root_logger = logging.getLogger()
|
|
root_logger.setLevel(logging.DEBUG) # Catch ALL
|
|
root_logger.addHandler(file_handler)
|
|
root_logger.addHandler(console_handler)
|
|
|
|
# Silence noisy libs partially
|
|
logging.getLogger("uvicorn.access").setLevel(logging.INFO)
|
|
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO) # Set to DEBUG to see SQL queries!
|
|
|
|
logging.info(f"Logging initialized. Writing to {log_file}") |