-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_debug_logging.py
More file actions
100 lines (76 loc) · 3.36 KB
/
Copy pathtest_debug_logging.py
File metadata and controls
100 lines (76 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env python3
"""
Test script to verify comprehensive debug logging is present in job_detail.html
"""
import re
from pathlib import Path
def test_debug_logging():
"""Check that all debug logging has been added to the template"""
template_path = Path('/Volumes/nvme/Github/bmyCure4MM/chemtools/templates/chemtools/job_detail.html')
if not template_path.exists():
print(f"❌ Template not found: {template_path}")
return False
content = template_path.read_text()
print("🔍 Checking for debug logging in job_detail.html...\n")
checks = [
# Banner
("Debug Mode Banner", r"DEBUG MODE ACTIVE"),
# Function group headers
("Content Reorganization Group", r"\[DEBUG\].*Starting Content Reorganization"),
("Button Processing Group", r"\[DEBUG\].*Processing Control Buttons"),
("Viewer Availability Group", r"\[DEBUG\].*Checking Viewer Availability"),
("Initialization Group", r"\[DEBUG\].*Starting Viewer UI Initialization"),
# Detailed logging
("Container Found Log", r"Container found:"),
("Info Div Log", r"Info div found:"),
("Table Count Log", r"Total tables found:"),
("Button Count Log", r"Total buttons:"),
("Viewer Ready Log", r"Viewer ready:"),
# Performance tracking
("Performance Timer Start", r"console\.time\('reorganizeBindingContent'\)"),
("Performance Timer End", r"console\.timeEnd\('reorganizeBindingContent'\)"),
# State checks
("DOM Check Object", r"DOM Check:"),
("Final State Summary", r"Final State Summary"),
# Click tracking
("Click Event Listener", r"addEventListener\('click'"),
("Button Click Debug", r"\[DEBUG\].*Button Click"),
# Extract field logging
("Extract Field Logging", r"extractField.*\$\{label\}"),
# Summary tables
("Console Table", r"console\.table"),
]
passed = 0
failed = 0
for name, pattern in checks:
if re.search(pattern, content, re.IGNORECASE):
print(f"✅ {name}")
passed += 1
else:
print(f"❌ {name} - Pattern not found: {pattern}")
failed += 1
print(f"\n{'='*60}")
print(f"Results: {passed} passed, {failed} failed")
print(f"{'='*60}\n")
# Count total console.log statements
console_logs = len(re.findall(r'console\.(log|group|warn|error|time)', content))
print(f"📊 Total console logging statements: {console_logs}")
# Count console.group statements
console_groups = len(re.findall(r'console\.group', content))
print(f"📦 Console groups: {console_groups}")
# Count debug markers
debug_markers = len(re.findall(r'\[DEBUG\]', content))
print(f"🔍 Debug markers: {debug_markers}")
# Count emojis in logs
emoji_logs = len(re.findall(r'console\.(log|group).*[🔄🎮🔍🚀📊🖱️✅❌⏳]', content))
print(f"✨ Logs with emojis: {emoji_logs}")
print()
if failed == 0:
print("🎉 All debug logging checks passed!")
return True
else:
print(f"⚠️ {failed} checks failed. Review the output above.")
return False
if __name__ == '__main__':
success = test_debug_logging()
exit(0 if success else 1)