DebugLn: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: DebugLn
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **DebugLn** is a [[LazLogger]] procedure that can assist debugging. | |
| 2 | + | ||
| 3 | + | In your main program use code like: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | program main; | |
| 7 | + | uses | |
| 8 | + | {$ifdef DEBUG} | |
| 9 | + | LazLogger; | |
| 10 | + | {$end} | |
| 11 | + | ||
| 12 | + | ... | |
| 13 | + | ||
| 14 | + | end. | |
| 15 | + | ``` | |
| 16 | + | ||
| 17 | + | In units where you need debugln-style debugging: | |
| 18 | + | ||
| 19 | + | ``` pascal | |
| 20 | + | uses | |
| 21 | + | {$ifdef DEBUG} | |
| 22 | + | LazLoggerBase; | |
| 23 | + | {$else} | |
| 24 | + | LazLoggerDummy; | |
| 25 | + | {$end} | |
| 26 | + | ||
| 27 | + | procedure dosomething(); | |
| 28 | + | var | |
| 29 | + | s: string; | |
| 30 | + | begin | |
| 31 | + | ... | |
| 32 | + | debugln( s ); | |
| 33 | + | ... | |
| 34 | + | end; | |
| 35 | + | ``` | |
| 36 | + | ||
| 37 | + | Syntax of `debugln` is comparable to [[writeln]] syntax. | |
| 38 | + | ||
| 39 | + | --- | |
| 40 | + | *From the Free Pascal wiki, page "DebugLn", as it stood on 2022-05-28 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 41 | + | Category: Debugging | |
| 42 | + | Category: Lazarus |
