mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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).
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user