Inappropriate Log Level (ARCH5161)
Esta página aún no está disponible en tu idioma.
Key go.logging.inappropriate-log-level · Severity info · Category logging
Logging errors at Info/Debug and routine flow at Error breaks alerting and floods logs with noise. The level should reflect the true significance of the event.
Incorrect
Section titled “Incorrect”func save(log *slog.Logger, err error) { if err != nil { log.Info("save failed", "err", err) // error at Info }}Correct
Section titled “Correct”func save(log *slog.Logger, err error) { if err != nil { log.Error("save failed", "err", err) }}Log errors at Error, routine flow at Info, and verbose tracing at Debug.