Duplicate Log Message (ARCH2162)
Esta página aún no está disponible en tu idioma.
Key python.logging.duplicate-log-message · Severity info · Category logging
Repeating identical log message literals within the same module or class makes log lines ambiguous about their source. When triaging a failure you cannot tell which code path emitted the message.
Incorrect
Section titled “Incorrect”def save(user): if not user.email: logger.warning("Validation failed") if not user.name: logger.warning("Validation failed")Correct
Section titled “Correct”def save(user): if not user.email: logger.warning("Validation failed: missing email") if not user.name: logger.warning("Validation failed: missing name")Make each log message unique with context that distinguishes its source.