---
title: Do Not Use Error Log For Non-critical
impact: HIGH
impactDescription: prevents alert fatigue and log noise
tags: logging, log-levels, error, observability, quality
---

## Do Not Use Error Log For Non-critical

Incorrect log levels cause alert fatigue and hide real issues. When everything is an "error", nothing is.

**Incorrect (overusing error level):**

```go
// NOT an error - expected business case
slog.Error("User entered wrong password")

// NOT an error - validation failure
slog.Error("Email format invalid")

// NOT an error - temporary network issue
slog.Error("Retry attempt 2 of 5")
```

**Correct (appropriate log levels using slog):**

```go
// WARN - recoverable, may need attention
slog.Warn("Payment retry attempt", "attempt", 2, "max_attempts", 5)

// INFO - normal business events
slog.Info("Login failed - invalid password", "user_id", userID, "attempts", 3)

// DEBUG - detailed troubleshooting
slog.Debug("Validation failed", "field", "email", "value", maskedEmail)

// ERROR - only for actual system failures
slog.Error("Database connection lost", "host", dbHost, "error", err)
```

**Log Level Guide:**

| Level | Use For |
|-------|---------|
| ERROR | System failures, crashes, unrecoverable |
| WARN  | Potential issues, degraded performance |
| INFO  | Business events, state changes |
| DEBUG | Detailed troubleshooting |

**Tools:** Log linter, Custom rule, `slog` (standard library)
