26 lines
610 B
Python
26 lines
610 B
Python
"""
|
|
app_logger.py - Central logging til fil i stedet for konsol.
|
|
Paa Windows uden konsol skrives alt til ~/.linedance/app.log
|
|
"""
|
|
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
LOG_PATH = Path.home() / ".linedance" / "app.log"
|
|
|
|
|
|
def setup_logging():
|
|
LOG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
handlers = [logging.FileHandler(LOG_PATH, encoding="utf-8")]
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
handlers=handlers,
|
|
force=True,
|
|
)
|
|
|
|
|
|
logger = logging.getLogger("linedance")
|