Custom Format Tags are "wildcard" compared

In TMSLoggingCore.pas, when you use a custom formats, the tags are compared with the Contains function, so if there are any wildcard matches with predefined tags, it won't fire OnCustomFormat event.

Ex.: I tryed to use {%identikit} as a custom format tag, but in line 1852 it'll enter this if block, just because it has a 'D' . (I also had two other tags with the substring 'hex', that I had to change)

1852 else if rs.ToUpper.Contains('D') or rs.ToUpper.Contains('X') then

so, it never reaches this block:

        else if rs <> '' then
        begin
          Inc(p);
          v := GetCurrentValue;
          if Assigned(OnCustomFormat) then
            OnCustomFormat(Self, v, rs, s);
        end;

so, for the same reason, in line 1666,
if rs.ToUpper.Contains('HEX') or rs.ToUpper.Contains('BIN') or rs.ToUpper.Contains('PICHEX') then

there's a redundant check, once PICHEX would result True in .Contains('HEX') ; and it could be worse if the comparison to the 'X' tag (in line 1852) had been coded before this check. It would never reach the right block for HEX or PICHEX.

I understand it can't directly use Equals instead of Contains because there are some tags with extra parameters inside the curly brackets that must be treated.

Could it check the tags in some other way to avoid this wildcard problem?

Meanwhile, I solved it by changing my custom tag to something with no previous reserved letter or substring.
Thanks.

Thanks for reporting. We will investigate this, but it will not be trivial as this is critical code and given the way it's coded now, any change might break lots of things. I'm afraid that the workaround, for a while, would be indeed using a custom tag that doesn't match any of the previous tags.