[Lazarus] RFC: Code tools Feature?
Martin Frb
lazarus at mfriebe.de
Thu Mar 27 11:55:54 CET 2014
On 27/03/2014 08:22, Michael Van Canneyt wrote:
>
> The intended use is that the IDE generates stuff like
>
> Procedure TMyClass.MyMethod;
>
> begin
> {$IFDEF LOGPROCESSFLOW}Log('Entering TMyClass.MyMethod');{$ENDIF}
>
> {$ENDIF LOGPROCESSFLOW}Log('Exiting TMyClass.MyMethod');{$ENDIF}
> end;
>
> If I have specified as code snippets
>
> {$IFDEF LOGPROCESSFLOW}Log('Entering
> $(CLASSNAME).$(METHODNAME)');{$ENDIF}
>
Not an exact match to your question, but: Do you know LazLogger!
It has DebuglnEnter/DebuglnExit which will add a nice intend (so long as
you do not skip them by raising an exception.
You can use a code template, to insert them at caret.
debugln(['$ProcedureName() '|]);
If you are at the begin of a procedure, you can record a macro, using
the key stroke for "find block other end", that allows to insert opening
and closing statement.
In addition, you do not need the IfDef.
Debugln is in unit LazLoggerBase or LazLogger.
If you change the "uses" to LazLoggerDummy, then all debugln are
replaced by empty inline methods (the inline does not work for "array of
const" though).
LazLoggerBase gets a working debugln, but logs to nowhere. (use in
packages, and units)
LazLogger installs the actual Logger (to file or console). Affects all
debugln that where used from LazLoggerBase (use in your main unit)
it allows on command line
--debug-log=
--debug-enable
--debug-disable
debuglneEnter/Exit can be grouped to be enabled/disabled
Debugln(GROUPNAME, ['msg', data])
see gdbmidebugger units how to "RegisterLogGroup"
More information about the Lazarus
mailing list