Board logo

Subject: Don't know how to use CnDebug [Print This Page]

Author: seekbirdy    Time: 2007-9-13 20:41     Subject: Don't know how to use CnDebug

Hello All!

At first, thanks a lot for the great stuff!

My problem is that I didn't manage how to make CnDebugger work.
As I understood from the manual, it's enough just to add CnDebug.pas to my uses list
and to use CnDebugger global object's functions.

But when I run CnDebug Viewer nothing is displayed...
Should some $DEFINE's be set or whatever else?

Thanks in advance!
Author: shenloqi    Time: 2007-9-14 13:48

If you use debug viewer in vista, you should run debug viewer as administrator. (even you did that, debug viewer sometimes still not work properly in vista)

To enable debug viewer to debug your application, you should build your application with the conditional: DEBUG or ALLDEBUG. You can set it in project options -> Directories/Conditionals. Once you set the conditional, you should build (not compile) your application to make the conditional work.
Author: seekbirdy    Time: 2007-9-17 15:34

Thanks a lot! The conditional was the missing component. All is working!

But an extra question: could the log (trace) info be automatically saved into the file by default
(without using the CnDebugViewer)? I want to make some kind of usage statistics in my application.

Thanks in advance.
Author: yj_yulin    Time: 2007-9-22 23:11

you have the cndebug.pas ,
i think redirect the message to file is not so hard,
but of course, it is good to have the option to just log the messge and don't show the viewer.
Author: Passion    Time: 2007-9-23 01:51

CnDebugger's protected method "InternalOutputMsg" is used to put all fields to Channel. If interesting, you can modify it and redirect to a file.
It will be so nice if you can implement it and we canl add your enhancement to our CnDebug.pas.
Author: seekbirdy    Time: 2007-9-24 15:10

well, thanx for the hint, I've implemented the simple output into a file...
But can I somehow transform it into XML that could be later opened by the Load command in Viewer?
Is there any specification (DTD, XML Schema, ...) or maybe src file of this transformation?
If this can be done, I'd like to submit an enchancement to you; but if no, there is a 10 lines of code
that should be added for simply output to a file... I'm not sure if  it's  worth to do  

[ Last edited by  seekbirdy at 2007-9-24 15:16 ]
Author: Passion    Time: 2007-9-24 18:13

XML writing need XML lib. it's not included in CnDebug.pas. We want to make CnDebug.pas clean, So I think the format of output may only be text.

CnDebugViewer uses OmniXML lib to write messages to XML format. Maybe we can add a "load from txt" function in CnDebugViewer.
Author: seekbirdy    Time: 2007-9-24 21:32

Ok, anyway thanks a lot!
Sending a pretty silly enhancement with output to a file.
Here is it (in attachment).

Just set FileName property of CnDebugger to the desired filename.
Text is not formatted in the output file, so waiting for a feature in a CnDebugViewer!

[ Last edited by  seekbirdy at 2007-9-24 21:33 ]

Attachment: [CnDebug.pas with output to a file] CnDebug.pas (2007-9-24 21:32, 75.7 K) / Download count 831
http://bbs.cnpack.org/attachment.php?aid=350
Author: Passion    Time: 2007-9-25 02:31

OK.?Thanks for your contribution.?You'll in our credits.

I've merge your modification to our CVS and add a property DumpToFile: Boolean to control this behaviour. File extension use "*.cdd". it means CnDebug Dump.
A condition DUMP_TO_FILE can?also be used to enable it.

And CnDebugViewer now can read cdd file and display it.

If interesting ,you can use CVS to obtain the latest code and compile a CnDebugViewer to verify it for us.
http://www.cnpack.org/showdetail.php?id=372

Or, wait for a new nightly build version of CnWizards tommorow or a few days later.
Author: seekbirdy    Time: 2007-9-25 14:19

Thank you so much for the feature!

Sorry but I can't download the sources from CSV today due to traffic limitation...
Maybe I could do it in a few days... or just download a nightly build mentioned by you
Dunno what will come earlier.
Author: Passion    Time: 2007-9-27 15:55

0.8.2.333 unstable comes out. You can download it from:

http://www.cnpack.org/downbuilds.php




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0