OutputDebugString

From Lazarus wiki

OutputDebugString( ) is a Windows method for emitting a text string to some output device (window/file/external debugger).

Lazarus will show these messages in the IDE Window: Event Log accessible from Main menu > View > Debug Windows > Event Log. Alternatively, the shortcut keys Ctrl+Alt+V will open the Event Log window.

Note: You will need to include the Windows unit for the WinAPI in your application's Uses clause.