Hello, Recently I've made a class to generate error log for codes in Delphi and Free Pascal. It works capturing the class name where the problem occurred, adding the date/time concatenated with the error message. It's working perfectly in Delphi.
The problem is in Free Pascal and in your approach to save the name of specialized classes. They are very weird names and a little intuitive. For example: TFoo$1$crcB96581A6 Assuming the small code below is my log generator, see the output generated by Delphi code: program Project1; {$APPTYPE CONSOLE} uses System.SysUtils; type TTest = class(TObject) end; TFoo<T> = class(TObject) public class procedure Log(AClass: System.TClass); end; TBar1 = TFoo<TTest>; // short declaration TBar2 = class(TFoo<TTest>) // full declaration end; class procedure TFoo<T>.Log(AClass: System.TClass); begin System.WriteLn('[', System.SysUtils.FormatDateTime('hh:nn:ss.zzz', System.SysUtils.Now), ']: ', AClass.ClassName); end; begin TFoo<TTest>.Log(TBar1); TFoo<TTest>.Log(TBar2.ClassParent); System.ReadLn; end. Output: [06:27:08.545]: TFoo<Project1.TTest> [06:27:08.546]: TFoo<Project1.TTest> Now, see the same output for a Free Pascal code: program Project1; {$mode delphi} uses SysUtils; type TTest = class(TObject) end; TFoo<T> = class(TObject) public class procedure Log(AClass: System.TClass); end; TBar1 = TFoo<TTest>; // short declaration TBar2 = class(TFoo<TTest>) // full declaration end; class procedure TFoo<T>.Log(AClass: System.TClass); begin System.WriteLn('[', SysUtils.FormatDateTime('hh:nn:ss.zzz', SysUtils.Now), ']: ', AClass.ClassName); end; begin TFoo<TTest>.Log(TBar1); TFoo<TTest>.Log(TBar2.ClassParent); System.ReadLn; end. Output: [06:27:08.545]: TFoo$1$crcB96581A6 [06:27:08.545]: TFoo$1$crcB96581A6 It is very weird this generated class names. The Free Pascal will continue to use these weird names or there are plans to improve this in future versions? With names like that is almost impossible to create automated error logs structures with Free Pascal. Thank you! -- Silvio Clécio My public projects - github.com/silvioprog
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal