Is there any way to know the name of a method I'm currently in?
So that:
procedure TMyObject.SomeMethod();
begin
Writeln('my name is: ' + <hocus pocus>);
end;
would produce this output:
my name is: SomeMethod
Is there any way to know the name of a method I'm currently in?
So that:
procedure TMyObject.SomeMethod();
begin
Writeln('my name is: ' + <hocus pocus>);
end;
would produce this output:
my name is: SomeMethod
JCL is free and has functions for that. It does depend on how well a stack trace can be made and how much debug information is present.
JclDebug.pas
function FileByLevel(const Level: Integer = 0): string;
function ModuleByLevel(const Level: Integer = 0): string;
function ProcByLevel(const Level: Integer = 0): string;
function LineByLevel(const Level: Integer = 0): Integer;