Refact: Update loggings (#12014)

### What problem does this PR solve?

Refact: Update loggings

### Type of change

- [x] Refactoring
This commit is contained in:
Magicbook1108
2025-12-18 14:18:03 +08:00
committed by GitHub
parent 5cd1a678c8
commit 2331b3a270
2 changed files with 14 additions and 15 deletions

View File

@ -45,9 +45,9 @@ def get_opendal_config():
# Only include non-sensitive keys in logs. Do NOT
# add 'password' or any key containing embedded credentials
# (like 'connection_string').
safe_log_keys = ['scheme', 'host', 'port', 'database', 'table']
loggable_kwargs = {k: v for k, v in kwargs.items() if k in safe_log_keys}
logging.info("Loaded OpenDAL configuration (non sensitive): %s", loggable_kwargs)
SAFE_LOG_KEYS = ['scheme', 'host', 'port', 'database', 'table'] # explicitly non-sensitive
loggable_kwargs = {k: v for k, v in kwargs.items() if k in SAFE_LOG_KEYS}
logging.info("Loaded OpenDAL configuration (non sensitive fields only): %s", loggable_kwargs)
# For safety, explicitly remove sensitive keys from kwargs after use
if "password" in kwargs: