Forum Replies Created
-
AuthorPosts
-
I wrote several helpers for using CodeSite, which allow to send a list of any parameters to CodeSite in a convenient (for me) tabular form.
For illustration, it might look like this:
CodeSite.Send(‘CreateFile’, LogParams.
Str ( ‘lpFileName’, AFileName).
Int ( ‘dwDesiredAccess’, ADesiredAccess).
Int ( ‘dwShareMode’, AShareMode).
Ptr ( ‘lpSecurityAttributes’, ASecAttrs)
…
);The implementation of this syntax became possible thanks to the overload Send method, which accepts the ICodeSiteCustomData interface. But when I wanted to use the same my LogParams helper to log the input parameters when calling CodeSite.EnterMethod (and to log the output parameters by calling CodeSite.ExitMethod), I ran into the lack of overloads I needed.
Simply put, I can write:
function TMyClass.MyMethod(const APar1: Integer; var APar2: string): Boolean;
begin
CodeSite.EnterMethod(Self, ‘MyMethod’);
try
CodeSite.Send(‘MyMethod’, LogParams.
Int (‘APar1’ , APar1));…
…
finally
CodeSite.Send(‘MyMethod’, LogParams.
Str (‘APar2’ , APar1).
Bool (‘Result’ , Result));
CodeSite.ExitMethod(Self, ‘MyMethod’, Result);
end;
end;But I can not write:
function TMyClass.MyMethod(const APar1: Integer; var APar2: string): Boolean;
begin
CodeSite.EnterMethod(Self, ‘MyMethod’, LogParams.
Int (‘APar1’ , APar1));
try
…
…
finally
CodeSite.ExitMethod(Self, ‘MyMethod’, LogParams.
Str (‘APar2’ , APar1).
Bool (‘Result’ , Result));
end;
end;I began to understand the reasons for the limitations of the EnterMethod ExitMethod methods. I saw that CodeSiteLogger, when sending a message to the dispatcher, does not send the inspection type TCodeSiteInspectorType separately, everything is transferred through the integer MsgType. The viewer, having received the data written by the dispatcher, does not even try to display the data that came along with the csmEnterMethod, because it does not know TCodeSiteInspectorType and cannot figure it out from the neutral constant csmEnterMethod.
I planned, when logging incoming and outgoing parameters, to transfer my constants (csmEnterMethodParamString, csmEnterMethodParamTable, csmEnterMethodParamProps, csmEnterMethodParamTree and csmExitMethodParamString, csmExitMethodParamTable,
csmExitMethodParamProps, csmExitMethodParamTree) and support them in the viewer.Sorry for my awful English, I used a machine translator.
If, to illustrate my thoughts, it is necessary to demonstrate examples of some sources, then I suggest writing off by e-mail
-
AuthorPosts