how to log < >

I want to log any Entity-changes in a specific case using TMSLogger.

So I registered OnUpdated-Event in my MappingExplorer and log values like this:

  for sCols in aArgs.ChangedColumnNames do
  try
    sOldValue := '';
    sNewValue := '';
    if aArgs.OldColumnValues.TryGetValue(sCols, hOldValue) and not VarIsEmpty(hOldValue) and not VarIsNull(hOldValue) then
      sOldValue := hOldValue;
    if aArgs.NewColumnValues.TryGetValue(sCols, hNewValue) and not VarIsEmpty(hNewValue) and not VarIsNull(hNewValue) then
      sNewValue := hNewValue;

    TMSLogger.InfoFormat('"{%s}" changed from {%s} to {%s}', [sCols, sOldValue, sNewValue]);
  except
    on Exception do
      TMSLogger.InfoFormat('"%s" has changed, but content could not be logged', [sCols]);
  end;

If I use the above given Code, some Values like:
sOldValue = '2LfdNo:5'
sNewValue = '2SeqNo:5'
sCols = 'FieldName'

will be logged like this:

[Value: "FieldName" changed from 2 to 2]

but it should be

[Value: "FieldName" changed from 2<YYYY><LfdNo:5> to 2<YYYY><SeqNo:5>]

How do I have to escape the parameters, or is this a bug?

In the configured output handler you are using, set the StripHtml property to False. This will avoid removing the text inside tags.

That's exactly what I did...
But it looks like it does not work for Parameters.

registering Logger:

FLogOutPutHandler := TTMSLoggerBrowserOutputHandler.Create(nil);
FLogOutPutHandler.StripHtml := False;
TMSDefaultLogger.RegisterOutputHandler(FLogOutPutHandler);

Logging Data:

var
  hHandler: TTMSLoggerBaseOutputHandler;
begin
  for hHandler in TMSLogger.OutputHandlers do // try to ensure not StripHTML, but debugger shows, it Is False...
    hHandler.StripHtml := False;

  TMSLogger.InfoFormat('"{%s}" check.', ['Test<abc><def>']);
  TMSLogger.InfoFormat('"{%s}" <check> 2.', ['Test<abc><def>']);
end;

StripHtml works fine for TRichEditOutputHandler or TTMSLoggerTextOutputHandler but it looks like it does not work as expected in TTMSLoggerBrowserOutputHandler, or maybe Browser tries to interpret HTML...

Exactly, it doesn't make sense to use StripHtml in the HTML output handlers because obviously the tags are needed for proper formatting.

You can simply escape your value before logging:

  TMSLogger.InfoFormat('"{%s}" check.', [TNetEncoding.HTML.Encode('Test<abc><def>')]);

but there are several Loggers active...
So I think it should be done by HTML-Logger, maybe by setting a new property to keep current behaviour...

Or maybe StripHtml could just call TNetEncoding for given Messages and parameter in HTML-Logger...

Fair enough. We added EncodeHtml property to the HTML-based output handlers.

Is there any release date you could publish?

We will release it until next week.