Board index » delphi » Log file (debug)

Log file (debug)


2006-06-30 03:39:20 PM
delphi270
Hi,
I have a procedure which writes info to a log file. But I only need to activate this procedure only when debug the program (live run don't need to use this procedure).
How can I do that?
Thanks
 
 

Re:Log file (debug)

Hello Alan
I found the following article by Brian Long very helpful:
Brian Long
Non-obvious Debugging Techniques
BorCon 2002
www.blong.com/Conferences/BorCon2002/Debugging/3188.htm
Cheers
Lars
--
Lars Frische
Software Developer
Test Maschinen Technik GmbH
Germany
===
www.eddyMax.com
www.kontrolltechnik.com
 

Re:Log file (debug)

"Alan" <XXXX@XXXXX.COM>writes:
Quote

Hi,
I have a procedure which writes info to a log file. But I only need to activate this procedure only when debug the program (live run don't need to use this procedure).
How can I do that?

Thanks
I've done something similar in a very simple way.
I've created a menu item (say, in the File menu) called Debug, and assigned the Ctrl-D shortcut to it. Then I set Visible to False. In the handler, I merely invert a debug flag to indicate the current state (always starts as false). That way, I can always press Ctrl-D to invoke debugging, but it is hidden to the general user.
HTH
Ron Keen
 

Re:Log file (debug)

Quote
I've created a menu item (say, in the File menu) called Debug, and
assigned the Ctrl-D shortcut to it. Then I set Visible to False. In the
handler, I merely invert a debug flag to indicate the current state
(always starts as false). That way, I can always press Ctrl-D to invoke
debugging, but it is hidden to the general user.

Interesting idea, but I would recommend adding at least one more key to the
combination, since Ctrl+D is close enough to Ctrl+S (save), Ctrl+F (find),
Ctrl+Z,X,C,V (undo, cut, copy, paste) that I could see it getting hit
accidentally. i.e. just make it Shift+Ctrl+Alt+D or something...
-BKN
 

Re:Log file (debug)

Bryce K. Nielsen writes:
Quote
just make it Shift+Ctrl+Alt+D or something...
I've added a few "hidden" Ctrl-Alt-Shift combinations. It annoys QA and
Support to no end. That alone is worth it... :D
 

Re:Log file (debug)

"Alan" <XXXX@XXXXX.COM>skrev i en meddelelse
Quote
I have a procedure which writes info to a log file. But I only need to
activate this procedure only when debug the program (live run don't need
to use this procedure).
How can I do that?
if DebugHook <>0 then
{app is being debugged so do what you want}
--
Finn Tolderlund
www.tolderlund.eu/delphi/
 

Re:Log file (debug)

Quote
>just make it Shift+Ctrl+Alt+D or something...

I've added a few "hidden" Ctrl-Alt-Shift combinations. It annoys QA and
Support to no end. That alone is worth it... :D

hehehe, me too, my favorite has to be Ctrl+Alt+Shift+RightClick on an
obscure control.
-BKN