Skip to content

Commit d3503f9

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 d3503f9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

examples/show_debug_output.py

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

0 commit comments

Comments
 (0)