Mention that arguments are always evaluated, to curb enthusiasm at

putting too much fancy stuff in a logger call ;).

(Not actually an issue in our current codebase).
reviewable/pr8057/r3
NiLuJe 3 years ago
parent 0acf1a2b29
commit 2d12f8a8ee

@ -17,7 +17,12 @@ Anything printed by `logger.dbg` starts with `DEBUG`.
04/06/17-21:44:53 DEBUG foo
```
## Bug hunting in kpv
In production code, remember that arguments are *always* evaluated in Lua, so,
don't inline complex computations in logger functions' arguments.
If you *really* have to, hide the whole thing behind a `dbg.is_on` branch,
like in [frontend/device/input.lua](https://github.com/koreader/koreader/blob/ba6fef4d7ba217ca558072f090849000e72ba142/frontend/device/input.lua#L1131-L1134).
## Bug hunting in KPV (KOReader's predecessor)
A real example of bug hunting in KPV's cache system: <https://github.com/koreader/kindlepdfviewer/pull/475>

Loading…
Cancel
Save