[Gambas-user] using echo command within EXEC
Dimitris Anogiatis
dosida at ...626...
Fri Jan 21 07:42:22 CET 2011
Hey vikram,
Try this subroutine. Make a new module and add this in it
PUBLIC SUB append2log(text AS String)
DIM tmpFile AS File
tmpFile = OPEN User.Home &/ "Desktop/test1.txt" FOR APPEND
WRITE #tmpFile, text & gb.NewLine, Len(text & gb.NewLine)
CLOSE #tmpFile
END
if for example you call your module "helper" then you can use it in your
program
like this:
helper.append2log("Log Entry: " & Now())
helper.append2log("Main Form opened")
it should do the job and you don't need to use shell all the time to log
events into a log file
just make sure the file you're going to use is created in a folder with the
right permissions.
Otherwise Gambas is going to throw you an error message.
and unless you are fully debugging you really don't need to log every event
in your program
unless they are critical points with the potential for failure.
Hope this helps
Regards
Dimitris
On Wed, Jan 19, 2011 at 3:32 AM, vikram <austinium at ...43...> wrote:
> Hi,
>
> I am using Gambas 2.21, on Debian Squeeze. I am trying to keep a log of the
> things my application does, for instance events like forms opening, errors
> can be logged.
>
> I am thinking of using the SHELL with echo command to write to a log file.
>
> For example, using SHELL i would use:
> SHELL "echo \"Form1 Entered\">>Logfile"
>
> Could this cause the application to be a resource hog? The only other way I
> can think of to do logging is to use File I/O but that would be a lot of
> work when compated to using SHELL, plus I don't know it will prove to be
> more of a resource hog than using SHELL.
>
> Help!
>
> Thanks in advance,
> Regards,
> Vikram Nair
>
>
>
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list