website-htmx-rustelo-code/scripts/wrks/collect-browser-logs.sh
2026-07-10 03:44:13 +01:00

56 lines
No EOL
1.4 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Browser Log Collector - Collects logs and appends to file
# Usage: ./collect-browser-logs.sh [log_file]
set -e
LOG_FILE="$1"
TIMESTAMP=$(date +"%H:%M:%S")
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE} $1${NC}"; }
log_success() { echo -e "${GREEN}$1${NC}"; }
log_warning() { echo -e "${YELLOW}⚠️ $1${NC}"; }
log_error() { echo -e "${RED}$1${NC}"; }
if [ -z "$LOG_FILE" ]; then
log_error "Usage: $0 <log_file>"
exit 1
fi
if [ ! -f "$LOG_FILE" ]; then
log_error "Log file not found: $LOG_FILE"
exit 1
fi
log_info "Collecting browser logs to: $LOG_FILE"
# Append real browser logs to file
{
echo ""
echo "--- Real Browser Logs Collected at [$TIMESTAMP] ---"
echo ""
echo "=== Console Logs ==="
echo "BROWSER_LOGS_PLACEHOLDER:CONSOLE"
echo ""
echo "=== Console Errors ==="
echo "BROWSER_LOGS_PLACEHOLDER:ERRORS"
echo ""
echo "=== Network Errors ==="
echo "BROWSER_LOGS_PLACEHOLDER:NETWORK"
echo ""
echo "[$TIMESTAMP] Browser log collection markers added"
echo "[$TIMESTAMP] Ready for MCP browser tools integration"
} >> "$LOG_FILE"
log_success "Browser log placeholders added to: $LOG_FILE"
log_warning "Now run MCP browser tools to replace placeholders with real logs"
echo "COLLECT_BROWSER_LOGS_READY:$LOG_FILE"