Inappropriate Log Level (ARCH2161)
Ce contenu n’est pas encore disponible dans votre langue.
Key python.logging.inappropriate-log-level · Severity info · Category logging
Logging errors at info/debug or recording routine flow at error/critical misleads monitoring and alerting systems. The level should reflect the event’s true severity.
Incorrect
Section titled “Incorrect”try: charge(order)except PaymentError: logger.info("Payment failed")Correct
Section titled “Correct”try: charge(order)except PaymentError: logger.error("Payment failed")Match the log level to the event severity: errors at error, routine flow at info/debug.