MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _should_log

Function _should_log

src/codegraphcontext/utils/debug_log.py:33–53  ·  view source on GitHub ↗

Check if a message at the given level should be logged

(level_name)

Source from the content-addressed store, hash-verified

31 return default
32
33def _should_log(level_name):
34 """Check if a message at the given level should be logged"""
35 configured_level = _get_config_value('ENABLE_APP_LOGS', 'INFO')
36
37 # Handle legacy boolean values
38 if isinstance(configured_level, bool):
39 return configured_level
40
41 # Convert to uppercase for comparison
42 configured_level = str(configured_level).upper()
43
44 # If disabled, don't log anything
45 if configured_level == 'DISABLED':
46 return False
47
48 # Get numeric levels
49 configured_numeric = LOG_LEVELS.get(configured_level, logging.INFO)
50 message_numeric = LOG_LEVELS.get(level_name.upper(), logging.INFO)
51
52 # Log if message level >= configured level
53 return message_numeric >= configured_numeric
54
55def debug_log(message):
56 """Write debug message to a file if DEBUG_LOGS is enabled"""

Callers 5

info_loggerFunction · 0.85
error_loggerFunction · 0.85
warning_loggerFunction · 0.85
debug_loggerFunction · 0.85
critical_loggerFunction · 0.85

Calls 2

_get_config_valueFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected