www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Unbuffered logging

reply "Johan Engelen" <j j.nl> writes:
Hi all,
   While debugging an ICE, it was helpful to look at the Logger 
output (obviously :), but, because it is buffered, the output log 
did not stop at the point where the crash happened.
I added fflush(stdout) to Logger:printf/printfln to help with 
that.
Is this something more people would like to have? Can we add an 
option somewhere to enable this?

cheers,
   Johan
Apr 13 2015
parent reply "Kai Nacke" <kai redstar.de> writes:
On Monday, 13 April 2015 at 21:13:49 UTC, Johan Engelen wrote:
 Hi all,
   While debugging an ICE, it was helpful to look at the Logger 
 output (obviously :), but, because it is buffered, the output 
 log did not stop at the point where the crash happened.
 I added fflush(stdout) to Logger:printf/printfln to help with 
 that.
 Is this something more people would like to have? Can we add an 
 option somewhere to enable this?

 cheers,
   Johan
Hi Johan! IMHO the logger code needs to be redesigned and unified. But with the switch to DDMD I don't think that this has a high priority... Regards, Kai
Apr 13 2015
parent "Johan Engelen" <j j.nl> writes:
On Tuesday, 14 April 2015 at 05:15:51 UTC, Kai Nacke wrote:
 IMHO the logger code needs to be redesigned and unified. But 
 with the switch to DDMD I don't think that this has a high 
 priority...
Yeah I didn't mean anything big. pragma(LDC_verbose) is a big help for me as an D/LDC newb. Is there a good argument against simply flushing Logger::printf ? Yes it will be slower, but I think very few people compile programs with pragma(LDC_verbose) without trying to find a bug? :)
Apr 14 2015