Recent

Author Topic: How to write in the Lazarus IDE "Console In/output" window, on Linux  (Read 1727 times)

devEric69

  • Hero Member
  • *****
  • Posts: 648
Hello,

How can I write to debug in the " View > Debug Windows > Console In/Output " window, from a Linux Lazarus?

I've found this way that suits me. Personally, I write at the top of the unit:
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}{$H+}
  2. {$DEFINE DebugOnlyThisUnit__uFoo1}
  3.  
  4. ...\...
  5.  
  6. uses
  7. {$If defined(DebugOnlyThisUnit__uFoo1)}
  8. LazLogger,
  9. {$EndIf}
  10. ...\...;


Then, I initialize like this (at the bottom of the unit):

Code: Pascal  [Select][+][-]
  1. initialization
  2.     {$If defined(DebugOnlyThisUnit__uFoo1)}
  3.     LazLogger.GetDebugLogger.UseStdOut:= True;
  4.     DebugLn('Init: hello world');
  5.     {$EndIf}  


and I dispatch in the unit some stuffs like this:

Code: Pascal  [Select][+][-]
  1. {$If defined(DebugOnlyThisUnit__uFoo1)}
  2. DebugLn('Another stuff');
  3. DebugLn('Bye bye');
  4. {$EndIf}

Next, I need to run the application in a true debug mode (i.e. with the step by step, F9, etc, activated): only the output of the Lazarus application DebugLn are written here (there are no other messages like those from the GTK, the debugger, ...: in the terminal console, I have all the layers talking in it :-\ ): here, it's clearly only the application layer messages (if this tip can be useful to someone else...).
« Last Edit: November 05, 2021, 07:21:00 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

 

TinyPortal © 2005-2018