import logging
import os

def create_log_viewer_html(filepath: str) -> bool:
    """
    Creates a basic HTML file for viewing logs.

    Args:
        filepath: The path to save the HTML file.

    Returns:
        True if the file was created successfully, False otherwise.
    """
    try:
        html_content = """
<!DOCTYPE html>
<html>
<head>
    <title>Log Viewer</title>
    <style>
        body {
            font-family: monospace;
            background-color: #f0f0f0;
        }
        textarea {
            width: 95%;
            height: 80vh;
            padding: 10px;
            border: 1px solid #ccc;
            background-color: #fff;
            font-family: monospace;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <h1>Log Viewer</h1>
    <textarea id="logContent" readonly>
        <!-- Log content will be displayed here -->
    </textarea>
</body>
</html>
"""
        with open(filepath, "w") as f:
            f.write(html_content)
        return True
    except Exception as e:
        logging.error(f"Error creating log viewer HTML: {e}")
        return False


if __name__ == "__main__":
    log_viewer_path = "/mnt/e/genesis-system/core/web/log_viewer.html"
    success = create_log_viewer_html(log_viewer_path)

    if success:
        print(f"Log viewer HTML created successfully at {log_viewer_path}")
    else:
        print("Failed to create log viewer HTML.")