From f7c40d48c0727a96843c85990cc36ae5a9ac6888 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sat, 07 Feb 2026 23:42:43 +0000
Subject: [PATCH] Add integration test for binary

---
 src/archbuild/logging.py |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/src/archbuild/logging.py b/src/archbuild/logging.py
new file mode 100644
index 0000000..1b40804
--- /dev/null
+++ b/src/archbuild/logging.py
@@ -0,0 +1,62 @@
+"""Structured logging setup using Rich."""
+
+import logging
+from pathlib import Path
+
+from rich.console import Console
+from rich.logging import RichHandler
+
+console = Console()
+
+
+def setup_logging(
+    level: str = "INFO",
+    log_file: Path | None = None,
+) -> logging.Logger:
+    """Configure logging with Rich handler for pretty console output.
+
+    Args:
+        level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
+        log_file: Optional path to log file
+
+    Returns:
+        Configured logger instance
+    """
+    handlers: list[logging.Handler] = [
+        RichHandler(
+            console=console,
+            rich_tracebacks=True,
+            tracebacks_show_locals=True,
+            show_time=True,
+            show_path=False,
+        )
+    ]
+
+    if log_file:
+        log_file.parent.mkdir(parents=True, exist_ok=True)
+        file_handler = logging.FileHandler(log_file)
+        file_handler.setFormatter(
+            logging.Formatter("%(asctime)s | %(levelname)-8s | %(name)s | %(message)s")
+        )
+        handlers.append(file_handler)
+
+    logging.basicConfig(
+        level=getattr(logging, level.upper()),
+        format="%(message)s",
+        datefmt="[%X]",
+        handlers=handlers,
+    )
+
+    return logging.getLogger("archbuild")
+
+
+def get_logger(name: str) -> logging.Logger:
+    """Get a child logger for a specific module.
+
+    Args:
+        name: Module name for the logger
+
+    Returns:
+        Logger instance
+    """
+    return logging.getLogger(f"archbuild.{name}")

--
Gitblit v1.10.0