[Lazarus] RFC: Code tools Feature?

Michael Van Canneyt michael at freepascal.org
Thu Mar 27 13:09:14 CET 2014



On Thu, 27 Mar 2014, Martin Frb wrote:

> 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!

I do now :)

> 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.

But I want the ifdef :)

The reason is that I very often add some code inside the $IFDEF to check for assigned props, params and whatnot.
So, having it there from the start is an advantage.

And like I said: the feature can be used for a lot more than just logging.

Nevertheless, I am going to check out lazlogger in more detail. 
Seems like good stuff for an article. Thanks for the tip !

Michael.




More information about the Lazarus mailing list