Add network logging to Discord webhook for testing branch
- Add network_logging.py module with Discord webhook integration - Log session start with unique session ID and mode (MOCK/PRODUCTION) - Log all page navigations when clicking Next - Log all user selections (disk, install mode, modules, user info) - Log installation progress through each step - Send install completion/failure logs - Auto-flush logs every 2 seconds and immediately on critical events TESTING BRANCH ONLY - Remove before merging to main
This commit is contained in:
@@ -6,6 +6,15 @@ from contextlib import contextmanager
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Import network logging for critical operations
|
||||
from .network_logging import log_to_discord
|
||||
|
||||
|
||||
def log_os_install(operation, status="start", details=""):
|
||||
log_to_discord(
|
||||
"INFO", f"OSINSTALL_{operation}_{status}: {details}", module="os_install"
|
||||
)
|
||||
|
||||
|
||||
class CommandResult:
|
||||
def __init__(self, stdout, stderr, returncode):
|
||||
@@ -94,6 +103,7 @@ def install_minimal_os(mount_root, releasever="43"):
|
||||
Installs minimal Fedora packages to mount_root.
|
||||
"""
|
||||
logger.info(f"Installing minimal Fedora {releasever} to {mount_root}...")
|
||||
log_os_install("INSTALL", "start", f"Target: {mount_root}, Release: {releasever}")
|
||||
|
||||
packages = [
|
||||
"basesystem",
|
||||
@@ -125,6 +135,7 @@ def install_minimal_os(mount_root, releasever="43"):
|
||||
run_command(cmd)
|
||||
|
||||
logger.info("Base system installation complete.")
|
||||
log_os_install("INSTALL", "complete", f"Installed to {mount_root}")
|
||||
|
||||
|
||||
def configure_system(mount_root, partition_info):
|
||||
@@ -132,6 +143,7 @@ def configure_system(mount_root, partition_info):
|
||||
Basic configuration: fstab and grub.
|
||||
"""
|
||||
logger.info("Configuring system...")
|
||||
log_os_install("CONFIGURE", "start", f"Configuring system in {mount_root}")
|
||||
|
||||
# 1. Generate fstab
|
||||
def get_uuid(dev):
|
||||
@@ -168,3 +180,4 @@ UUID={efi_uuid} /boot/efi vfat defaults 0 2
|
||||
run_command(chroot_cmd)
|
||||
|
||||
logger.info("System configuration complete.")
|
||||
log_os_install("CONFIGURE", "complete", "GRUB configured successfully")
|
||||
|
||||
Reference in New Issue
Block a user