Difference between revisions of "DebugLn"
From Lazarus wiki
Jump to navigationJump to search (Created page with "'''DebugLn''' is a LazLogger procedure that can assist debugging. Category:Debugging") |
m (Add category) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''DebugLn''' is a [[LazLogger]] procedure that can assist debugging. | '''DebugLn''' is a [[LazLogger]] procedure that can assist debugging. | ||
+ | In your main program use code like: | ||
+ | <syntaxhighlight lang=pascal> | ||
+ | program main; | ||
+ | uses | ||
+ | {$ifdef DEBUG} | ||
+ | LazLogger; | ||
+ | {$end} | ||
+ | |||
+ | ... | ||
+ | |||
+ | end. | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | In units where you need debugln-style debugging: | ||
+ | <syntaxhighlight lang=pascal> | ||
+ | uses | ||
+ | {$ifdef DEBUG} | ||
+ | LazLoggerBase; | ||
+ | {$else} | ||
+ | LazLoggerDummy; | ||
+ | {$end} | ||
+ | |||
+ | procedure dosomething(); | ||
+ | var | ||
+ | s: string; | ||
+ | begin | ||
+ | ... | ||
+ | debugln( s ); | ||
+ | ... | ||
+ | end; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Syntax of <tt>debugln</tt> is comparable to <tt>[[writeln]]</tt> syntax. | ||
+ | |||
+ | [[Category:Lazarus]] | ||
[[Category:Debugging]] | [[Category:Debugging]] |
Latest revision as of 13:32, 28 May 2022
DebugLn is a LazLogger procedure that can assist debugging.
In your main program use code like:
program main;
uses
{$ifdef DEBUG}
LazLogger;
{$end}
...
end.
In units where you need debugln-style debugging:
uses
{$ifdef DEBUG}
LazLoggerBase;
{$else}
LazLoggerDummy;
{$end}
procedure dosomething();
var
s: string;
begin
...
debugln( s );
...
end;
Syntax of debugln is comparable to writeln syntax.