Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Logarray in Delphi?


#1

Hi.
I’m probably missing something obvious, but I can’t find a logarray method for Delphi. There is for Java and .Net?

Regards

Claes Enskär


#2

Hello Claes,

The reason why Delphi has no LogArray method is that you cannot easily get a string representation of an arbitrary value. In Java and .NET you can simply call the toString/ToString method. It might be possible to do something with Delphi’s RTTI in this case (as we do for LogObject). I added it to our feature request list.

If you are looking into logging an array of a specific type, you could also implement a custom logging routine. With newer versions of Delphi (I think since 2005 or 2006), you can implement so called helper classes which let you add new methods to existing classes. This way, it is quite simple to attach a new log method to the TSiSession class. An example of a helper class can be found here:

I’m happy to assist in implementing such a custom routine.


#3

Ok.

I’l try the classhelper solution.
(I’m primarily want to log only 1 or 2 array-types)

Regards
Claes Enskär