docs: add Logger.warn deprecation as common mistake

This commit is contained in:
Rodin
2026-05-10 21:24:24 -07:00
parent df9c856d96
commit e75a97707d
+22
View File
@@ -1160,3 +1160,25 @@ end
**Why it's OK here:** There's no conditional logic — every iteration tests the exact same behavior with a trivially predictable result. If one fails, the assertion message includes the specific value. The loop is purely for conciseness.
<!-- PATTERN_COMPLETE -->
---
## Logger.warn/2 is Deprecated
**Smell:** Using `Logger.warn/2` instead of `Logger.warning/2`
**Why it's wrong:** `Logger.warn/2` was deprecated in Elixir 1.11. The standard function is `Logger.warning/2`.
**Example — broken:**
```elixir
Logger.warn("Connection lost: #{reason}")
```
**Example — fixed:**
```elixir
Logger.warning("Connection lost: #{reason}")
```
**Source:** [Elixir 1.11 Changelog](https://hexdocs.pm/elixir/1.11/changelog.html#logger-improvements)
<!-- PATTERN_COMPLETE -->