diff --git a/doc/Hacking.md b/doc/Hacking.md index 2dc060d66..e5288e93a 100644 --- a/doc/Hacking.md +++ b/doc/Hacking.md @@ -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: