I have a large quantity of logging throughout my Delphi code, which often uses Self.ClassName to log the name of the class containing the currently executing code.
I am now compiling some of this code into a Delphi Prism .NET assembly.
However, under Delphi Prism, Self.ClassName now returns "TObjectExtender" instead of the actual classname.
e.g.
type
TMyClass: TObject
begin
procedure MyProc();
end;
...
procedure TMyClass.MyProc;
begin
Log(Format('%s: A log message', [Self.ClassName]));
end;
outputs
TMyClass: A log message
when compiled in Delphi XEII, but when compiled in Delphi Prism in VS 2010 outputs
TObjectExtender: A log message
regardless of the actual class containing the running code.
Can anyone suggest a way to get the actual classname in Delphi Prism please?
To get the name of current class just use
Self.GetType().Name