Search code examples
delphiindyindy10indy-8

Indy 8 to Indy 10 - What replaces TIdLogDebug component?


I have a project that was written in Delphi 6 and used Indy 8. I need to upgrade this project to Delphi 2005 and use Indy 10.

In Delphi 2005, when I open the Form containing the old Indy components, the following two errors occur:

Property OnLogItem does not exist

Property Target does not exist

Both of these errors have to do with Indy's TIdLogDebug component.

I have heard that instead of using the TIdLogDebug, one must use TIdLogEvent instead. However, this component does not have the OnLogItem and Target properties.

What event handler should I use with the TIdLogEvent component of Indy 10, that substitutes the OnLogItem event of the TIdLogDebug component of Indy 8?


Solution

  • TIdLogDebug itself still exists in Indy 10, but it is very different than Indy 8's TIdLogDebug. TIdLogDebug in Indy 9 and later does not have a Target property or an OnLogItem event anymore.

    Indy 8's TIdLogDebug was Indy's only logging component and it supported multiple types of output - file, debugger, and event. In Indy 9, that functionality was split into separate TIdLogFile, TIdLogDebug, and TIdLogEvent components (and a new TIdLogStream component was added).

    In Indy 9 and later, the TIdLogEvent component would be the correct replacement to use. TIdLogEvent has OnReceived, OnSent, and OnStatus events. Indy 8 did not differentiate between different directions of data flow in TIdLogDebug, everything was funneled through the single OnLogItem event. The log messages for each direction of data flow had different prefixes. In Indy 9 and later, separate events are now used for each direction, so there is no direct replacement for the old OnLogItem event. You need to update your code to fit in with the newer event model.