Skip to content

Commit cf8a6fe

Browse files
committed
examples: add demo to show all mavsdk_server output
This should now work properly thanks to this fix: mavlink/MAVSDK#2631
1 parent f8a2984 commit cf8a6fe

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

examples/show_debug_output.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Test to see all output including debug messages
4+
"""
5+
6+
import asyncio
7+
import logging
8+
from mavsdk import System
9+
10+
# Setup logging to see EVERYTHING
11+
logging.basicConfig(
12+
level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
13+
)
14+
15+
16+
async def test_see_all():
17+
print("Testing with DEBUG level to see all messages...")
18+
19+
drone = System()
20+
try:
21+
await asyncio.wait_for(drone.connect("invalid://bad:connection"), timeout=8)
22+
except asyncio.TimeoutError:
23+
print("Timed out - all messages should be visible above")
24+
except Exception as e:
25+
print(f"Got exception: {e}")
26+
27+
28+
if __name__ == "__main__":
29+
asyncio.run(test_see_all())

0 commit comments

Comments
 (0)