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

Cannot log key=value pairs


I am a new user of SmartInspect 3.1 0.8000 so I can be wrong but I am unable to log key=value pairs by proceeding as follows :

void Log (LPSTR Title, LPSTR Key, LPSTR Msg) {
TSiInspectorViewerContext * LContext;
LContext = new TSiInspectorViewerContext();
try {
// Add a group and the related entries.
LContext->StartGroup (“Keys”);
LContext->AppendKeyValue (Key, Msg);
//LContext->AppendKeyValue (Key, new UnicodeString (Msg));
//LContext->AppendKeyValue (Key, new WideString (Msg));
SiMain->LogCustomContext (Title, ltText, LContext);
catch (…) {
delete LContext;

The logged value should be a string but when I call this function as follows :
Log (“Title”, “SQL”, “select …”);
I see in both the log file and the viewer this :
even if I make a UnicodeString or a WideString of it.

I am using RAD Studio (C++Builder) 2007.
What am I doing wrong ?


Hello Pavel,

Thanks for your reporting this issue.

This behavior looks a bit odd. I guess that the C++Builder uses the wrong overload of the AddKeyValue method (the bool overload instead of the string overload). I will look into it.


I’ve looked into it and C++Builder indeed chooses the wrong overload. Instead of using the AppendKeyValue overload with the UnicodeString value parameter, it wrongly uses the version with the Boolean parameter (I’m not sure why this happens, but it looks like C++Builder has problems with mapping the LPSTR type to the correct overloaded version).

However, you can work around this problem easily by explicitly casting the LPSTR value to UnicodeString or WideString like this:

Please let me know if this works for you.


Yes, it works.
Thank you very much.