mirror of
https://git.zavage.net/Zavage-Software/smileyface.git
synced 2026-06-25 18:12:48 -06:00
Drop the config.spec/configobj configuration in favour of an AppSettings pydantic-settings model (settings.py) loaded from SMILEYFACE_-prefixed env vars or a .env file. Introduce AppContext (context.py) to carry settings plus logging, dispatch commands through a Click CLI (cli.py), and centralise log setup (logging_setup.py). Update hub_machine, datalayer, and scraping modules to consume the new context. Add .env.example and ignore .env. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
388 B
Python
17 lines
388 B
Python
import logging
|
|
|
|
from smileyface.settings import AppSettings
|
|
|
|
|
|
class AppContext:
|
|
def __init__(self, settings: AppSettings):
|
|
self.settings = settings
|
|
self.log = _LoggerDict()
|
|
|
|
|
|
class _LoggerDict:
|
|
"""Dict-like logger access: ctx.log["ut4"] -> logging.getLogger("ut4")"""
|
|
|
|
def __getitem__(self, name: str) -> logging.Logger:
|
|
return logging.getLogger(name)
|