#!/usr/bin/env bash
echo "=== Apache error log (vocabapi, last 30 lines) ==="
tail -n 30 /var/log/apache2/vocabapi_error.log 2>&1 || echo "(no log)"
echo ""
echo "=== Laravel log (last 80 lines) ==="
if [ -f /var/www/html/vocabapi/storage/logs/laravel.log ]; then
  tail -n 80 /var/www/html/vocabapi/storage/logs/laravel.log
else
  echo "(no laravel.log yet)"
fi
echo ""
echo "=== Reproduce: POST /api/auth/request-otp ==="
curl -s -i -X POST \
  -H "Content-Type: application/json" \
  -d '{"contact":"learner@vocabile.test"}' \
  https://vocabapi.allgifted.com/api/auth/request-otp | head -50
echo ""
echo "=== After reproduce: tail laravel.log again (last 40) ==="
tail -n 40 /var/www/html/vocabapi/storage/logs/laravel.log 2>&1
