MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / _should_log

Function _should_log

src/codegraphcontext/utils/debug_log.py:32–52  ·  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

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

Callers 4

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

Calls 2

_get_config_valueFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected