first commit

This commit is contained in:
2025-11-24 23:10:55 -06:00
commit 8315fa51c9
279 changed files with 74600 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
"""
Logging utilities for public web frontend.
Simplified logging wrapper using structlog.
"""
import structlog
import logging
import sys
from pathlib import Path
def setup_logging():
"""Configure structured logging for the web frontend."""
structlog.configure(
processors=[
structlog.processors.TimeStamper(fmt="iso"),
structlog.processors.add_log_level,
structlog.processors.StackInfoRenderer(),
structlog.dev.ConsoleRenderer()
],
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
context_class=dict,
logger_factory=structlog.PrintLoggerFactory(),
cache_logger_on_first_use=True,
)
def get_logger(name: str):
"""
Get a logger instance.
Args:
name: Logger name (usually __file__)
Returns:
Configured structlog logger
"""
if isinstance(name, str) and name.endswith('.py'):
# Extract module name from file path
name = Path(name).stem
return structlog.get_logger(name)
# Setup logging on module import
setup_logging()