Slack Output from iOS: every message posted twice [SOLVED]

Finally I managed to get TMSLogging with Slack Output working from an iOS device.

Initialization:

procedure init_TMSLogging;
var
L_Handler: TTMSLoggerSlackWebhookOutputHandler;
webhook: string;
begin
webhook := 'https://hooks.slack.com/services/xxxxxxxxxxxxxxx';
TMSLogger.RegisterOutputHandlerClass(TTMSLoggerSlackWebhookOutputHandler, [webhook]);
L_Handler := TTMSLoggerSlackWebhookOutputHandler.Create(webhook);
TMSLogger.RegisterManagedOutputHandler(L_Handler);
TMSLogger.Clear;
end;

simple usage with TMSLogger.Info('this is a Info');

But every message is posted twice to Slack.
Even old messages which were deleted from the app appear (twice) again in slack.

What's wrong ?

Regards
Michael Jung

Studying the source code found the error I made.

New initialisation proc

procedure init_TMSLogging;
var
L_Handler: TTMSLoggerSlackWebhookOutputHandler;
webhook: string;
begin
webhook := 'https://hooks.slack.com/services/xxxxxxxxxxxxxxx';
TMSLogger.RegisterOutputHandlerClass(TTMSLoggerSlackWebhookOutputHandler, [webhook]);
////// REMOVED L_Handler := TTMSLoggerSlackWebhookOutputHandler.Create(webhook);
////// REMOVED TMSLogger.RegisterManagedOutputHandler(L_Handler);
TMSLogger.Clear;
end;

Registering the class does also create the handler.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.