#!/bin/bash # Real-time error monitoring script # Watches for browser errors and server errors echo "==========================================" echo "REAL-TIME ERROR MONITORING" echo "==========================================" echo "Watching for browser errors..." echo "Press Ctrl+C to stop" echo "" # Browser errors log BROWSER_LOG="/tmp/browser-errors.log" SERVER_LOG="/tmp/obsidian-server.log" # Create browser log if it doesn't exist touch "$BROWSER_LOG" # Get initial sizes BROWSER_SIZE=$(stat -f%z "$BROWSER_LOG" 2>/dev/null || stat -c%s "$BROWSER_LOG" 2>/dev/null || echo 0) SERVER_SIZE=$(stat -f%z "$SERVER_LOG" 2>/dev/null || stat -c%s "$SERVER_LOG" 2>/dev/null || echo 0) # Watch both logs tail -f "$BROWSER_LOG" 2>/dev/null | while read line; do echo "🚨 [BROWSER] $line" done & TAIL_PID=$! # Also watch server stderr for error markers tail -f "$SERVER_LOG" 2>/dev/null | grep --line-buffered "BROWSER_ERROR\|Error\|error" | while read line; do echo "📋 [SERVER] $line" done & SERVER_PID=$! # Cleanup on exit trap "kill $TAIL_PID $SERVER_PID 2>/dev/null; exit" INT TERM echo "Monitoring active (PIDs: $TAIL_PID, $SERVER_PID)" echo "" # Wait wait