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:
2026-02-04 21:18:18 +01:00
parent e611f174be
commit f7bebc7f88
5 changed files with 430 additions and 87 deletions

View File

@@ -5,6 +5,14 @@ import logging
# Configure logging
logging.basicConfig(level=logging.INFO)
# Initialize network logging (TESTING BRANCH ONLY)
from .backend.network_logging import init_network_logging, add_discord_handler
init_network_logging(enabled=True)
add_discord_handler(logging.getLogger("iridium_installer"))
logger = logging.getLogger(__name__)
def main():
parser = argparse.ArgumentParser(description="Iridium OS Installer")
parser.add_argument(
@@ -25,40 +33,56 @@ def main():
if args.partition_disk or args.full_install:
from .backend.disk import auto_partition_disk, mount_partitions
from .backend.os_install import install_minimal_os, configure_system
target = args.partition_disk or args.full_install
logger.info(f"INSTALLER_START: Starting installation on {target}")
try:
print(f"Starting installation on {target}...")
print("Step 1: Partitioning...")
logger.info(f"INSTALLER_PARTITION: Partitioning disk {target}")
parts = auto_partition_disk(target)
logger.info(f"INSTALLER_PARTITION_COMPLETE: Created partitions {parts}")
if args.full_install:
print("Step 2: Mounting...")
logger.info("INSTALLER_MOUNT: Mounting partitions")
mount_root = "/mnt"
mount_partitions(parts, mount_root)
print("Step 3: Installing OS (this may take a while)...")
logger.info("INSTALLER_OS_INSTALL: Installing minimal OS")
install_minimal_os(mount_root)
logger.info("INSTALLER_OS_INSTALL_COMPLETE: OS installed successfully")
print("Step 4: Configuring Bootloader...")
logger.info("INSTALLER_GRUB: Configuring GRUB bootloader")
configure_system(mount_root, parts)
logger.info("INSTALLER_GRUB_COMPLETE: Bootloader configured")
print("Installation complete! You can now reboot.")
logger.info(
"INSTALLER_COMPLETE: Full installation finished successfully"
)
else:
print("Partitioning successful!")
print(f"EFI: {parts['efi']}")
print(f"Swap: {parts['swap']}")
print(f"Root: {parts['root']}")
return 0
except Exception as e:
error_msg = str(e)
print(f"Installation failed: {e}", file=sys.stderr)
logger.error(f"INSTALLER_ERROR: {error_msg}")
import traceback
traceback.print_exc()
logger.error(f"INSTALLER_TRACEBACK: {traceback.format_exc()}")
return 1
import gi
gi.require_version("Gtk", "4.0")
gi.require_version("Adw", "1")