Keeping LOG

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Keeping LOG

Post by esgici »

Hi All

Code debugging is un-ignorable need for every programmer and DEBUG facility of Clipper / Harbour / HMG is very handy; with a little drawback :
it's highly complex due to its features and not easy to learn and use.

For a little purpose, a little Msgxxx functions ( especially MsgDebug() of our genius Dr. Soto ) will be enough in many time, under many circumstances; remembering WAIT and ALERT() of console mode.

And we have a little problem too in this method : if required 'repetitive' calls ( such as into a loop ) of that Msg function, requiring repetitive answers may be annoying.

In this condition we need a "log" file to records repeating values.

My preference ( IMHO the easiest way to build a text file ) is using and ALTERNATE file.

Pseudo code :

Code: Select all

   build an empty log file
   
   begin loop
     .
     .
     .
     use "?" or QUOT() to write the log file
     .
     .
   end loop
   
   close log file and show content
Here two little and simple procedure to Open / Close and show log file



I hope will be useful.

Happy HMG'ing :D
Attachments
Altes.zip
Source and ReadMe files of xxxxALTE procedures
(1.97 KiB) Downloaded 304 times
Viva INTERNATIONAL HMG :D
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Keeping LOG

Post by bpd2000 »

Thank you Esgici
BPD
Convert Dream into Reality through HMG
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Keeping LOG

Post by Rathinagiri »

Nice example Esgici.

I create many text files (for report printing in old dot matrix printers) in a HMG application using set alternate. In that case, will this logic work?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Keeping LOG

Post by esgici »

Thanks Rathi
Rathinagiri wrote:I create many text files (for report printing in old dot matrix printers) in a HMG application using set alternate. In that case, will this logic work?
Sure; this is for building (text) file only, printing is other side of subject ;)

Simply you may need some little modification on 'defaulting parameters" points: you may want no defaulting file name parameter and produce an error message such as "no file name specified" or anything else. Or your default target file name will be different, FE "report.txt" instead of PROCNAME( 1 ) + ".LOG"

IMHO important point is : since '?' and QOUT() are for console, in GUI mode has no effect. Bu this not means "this command / function doesn't work on GUI mode"; instead, as seen in the example, they are working and makes their job successfully :arrow:

Best regards and Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Keeping LOG

Post by Rathinagiri »

I mean I am already using 'set alternate' in my existing HMG application for other text file creation. In that case both this log file and that text file will work separately?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Keeping LOG

Post by serge_girard »

Esgici,

What I use/do is following:

Code: Select all

SET PRINTER TO C:\folder\debug.TXT  
SET PRINTER ON 
SET CONSOLE OFF

<your loop>
? what_ever
....
...

SET PRINTER TO   
SET PRINTER OFF 
SET CONSOLE ON
The file C:\folder\debug.TXT is open in my editor for viewing.

Greetings, Serge
There's nothing you can do that can't be done...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Keeping LOG

Post by esgici »

Rathinagiri wrote:I mean I am already using 'set alternate' in my existing HMG application for other text file creation. In that case both this log file and that text file will work separately?
As far as I know no :(

Because there isn't a way to change target of '?' / QOUT() to this or that media / file.

Nevertheless we have other ways to write something to separate files.

I will work to build a sample for this.

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Keeping LOG

Post by esgici »

serge_girard wrote: What I use/do is following:
Yes, this way too is legal and possible.

Please look at here.

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Keeping LOG

Post by esgici »

Hi All
esgici wrote:...
Nevertheless we have other ways to write something to separate files.

I will work to build a sample for this.
As promised :
Screen shoot
Screen shoot
TestWTMTFSFT.jpg (9.75 KiB) Viewed 5486 times
WTMTFSFT.zip
Source and sample data file
(5.24 KiB) Downloaded 305 times
Look at ReadMe file for detailed info.

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
Post Reply