-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest_debug_mode.py
More file actions
53 lines (39 loc) · 1.77 KB
/
test_debug_mode.py
File metadata and controls
53 lines (39 loc) · 1.77 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
#!/usr/bin/env python3
"""
Test script for advanced debugging mode functionality
"""
import sys
import os
# Add the octoprint_ControlCenter directory to the Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'octoprint_ControlCenter'))
from utils.logger import get_logger, set_advanced_debug_mode, get_advanced_debug_mode
def test_debug_mode():
"""Test the advanced debugging mode functionality"""
print("Testing Advanced Debug Mode functionality...")
# Get a logger
logger = get_logger("test_logger")
# Test initial state
print(f"Initial debug mode state: {get_advanced_debug_mode()}")
# Test normal logging
print("\n--- Testing Normal Mode ---")
logger.info("This is an INFO message in normal mode")
logger.debug("This is a DEBUG message in normal mode (should not appear in file)")
# Enable debug mode
print("\n--- Enabling Debug Mode ---")
set_advanced_debug_mode(True)
print(f"Debug mode state after enabling: {get_advanced_debug_mode()}")
# Test debug logging
print("\n--- Testing Debug Mode ---")
logger.info("This is an INFO message in debug mode")
logger.debug("This is a DEBUG message in debug mode (should appear in file)")
# Disable debug mode
print("\n--- Disabling Debug Mode ---")
set_advanced_debug_mode(False)
print(f"Debug mode state after disabling: {get_advanced_debug_mode()}")
# Test normal logging again
print("\n--- Testing Normal Mode Again ---")
logger.info("This is an INFO message back in normal mode")
logger.debug("This is a DEBUG message back in normal mode (should not appear in file)")
print("\nTest completed! Check the log file for debug messages.")
if __name__ == "__main__":
test_debug_mode()