Skip to content

Commit 006ea85

Browse files
authored
Merge pull request #44 from JohanDevl/feature/go-migration
feat: add logs documentation and debug script
2 parents 1c91388 + e21b3c0 commit 006ea85

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

docker/debug-logs.sh

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/bash
2+
3+
# Debug script for monitoring Docker container logs in real-time
4+
# Export Trakt 4 Letterboxd
5+
6+
echo "=== Docker Logs Debug Script ==="
7+
echo ""
8+
9+
# Function to display usage
10+
usage() {
11+
echo "Usage: $0 [service-profile] [options]"
12+
echo ""
13+
echo "Service profiles:"
14+
echo " schedule-15min - Every 15 minutes (testing)"
15+
echo " schedule-6h - Every 6 hours (production)"
16+
echo " schedule-daily - Daily at 2:30 AM"
17+
echo " schedule-weekly - Weekly on Sundays"
18+
echo ""
19+
echo "Options:"
20+
echo " --follow, -f - Follow logs in real-time (default)"
21+
echo " --tail N - Show last N lines (default: 50)"
22+
echo " --since TIME - Show logs since TIME (e.g., '10m', '1h', '2023-01-01T10:00:00')"
23+
echo " --timestamps - Show timestamps"
24+
echo " --help, -h - Show this help"
25+
echo ""
26+
echo "Examples:"
27+
echo " $0 schedule-15min"
28+
echo " $0 schedule-6h --tail 100"
29+
echo " $0 schedule-daily --since 1h"
30+
echo ""
31+
}
32+
33+
# Default values
34+
PROFILE="schedule-15min"
35+
FOLLOW=true
36+
TAIL=50
37+
SINCE=""
38+
TIMESTAMPS=false
39+
40+
# Parse arguments
41+
while [[ $# -gt 0 ]]; do
42+
case $1 in
43+
schedule-15min|schedule-6h|schedule-daily|schedule-weekly)
44+
PROFILE="$1"
45+
shift
46+
;;
47+
--follow|-f)
48+
FOLLOW=true
49+
shift
50+
;;
51+
--tail)
52+
TAIL="$2"
53+
shift 2
54+
;;
55+
--since)
56+
SINCE="$2"
57+
shift 2
58+
;;
59+
--timestamps)
60+
TIMESTAMPS=true
61+
shift
62+
;;
63+
--help|-h)
64+
usage
65+
exit 0
66+
;;
67+
*)
68+
echo "Unknown option: $1"
69+
usage
70+
exit 1
71+
;;
72+
esac
73+
done
74+
75+
echo "Monitoring logs for profile: $PROFILE"
76+
echo ""
77+
78+
# Check if service is running
79+
if ! docker compose --profile "$PROFILE" ps | grep -q "Up"; then
80+
echo "⚠️ Service with profile '$PROFILE' is not running."
81+
echo ""
82+
echo "To start the service:"
83+
echo " docker compose --profile $PROFILE up -d"
84+
echo ""
85+
echo "Current running services:"
86+
docker compose ps --filter "status=running"
87+
exit 1
88+
fi
89+
90+
# Build docker logs command
91+
LOG_CMD="docker compose --profile $PROFILE logs"
92+
93+
if [ "$FOLLOW" = true ]; then
94+
LOG_CMD="$LOG_CMD --follow"
95+
fi
96+
97+
if [ -n "$TAIL" ]; then
98+
LOG_CMD="$LOG_CMD --tail=$TAIL"
99+
fi
100+
101+
if [ -n "$SINCE" ]; then
102+
LOG_CMD="$LOG_CMD --since=$SINCE"
103+
fi
104+
105+
if [ "$TIMESTAMPS" = true ]; then
106+
LOG_CMD="$LOG_CMD --timestamps"
107+
fi
108+
109+
echo "Command: $LOG_CMD"
110+
echo ""
111+
echo "🔍 Monitoring logs... (Press Ctrl+C to stop)"
112+
echo "============================================"
113+
echo ""
114+
115+
# Execute the command
116+
eval $LOG_CMD

logs/.gitkeep

100644100755
File mode changed.

logs/README.md

100644100755
File mode changed.

0 commit comments

Comments
 (0)