[Gambas-user] Application logging using SHELL
Demosthenes Koptsis
demosthenesk at ...626...
Wed Jan 19 11:58:59 CET 2011
here is an example i did.
if you like it you can use it.
---------------
' Gambas class file
PUBLIC hLog AS Stream
PUBLIC sFilename AS String = User.Home &/ ".MyLog.txt"
PUBLIC sLogEntry AS String
PUBLIC SUB Form_Open()
hLog = OPEN sFilename FOR APPEND
END
PUBLIC SUB Button1_Click()
sLogEntry = "Button1 was clicked"
WriteToLog(Application.Name & " # " & Application.Version & " # " &
Now & " # " & sLogEntry)
END
PUBLIC SUB WriteToLog(sString AS String)
PRINT #hLog, sString
END
PUBLIC SUB Form_Close()
hLog.Close
END
----------------
On Wed, 2011-01-19 at 02:35 -0800, vikram 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
>
> @Mods: kindly delete the earlier thread titled "using echo command within EXEC", i had sent it with a wrong subject by mistake.
>
>
>
>
> ------------------------------------------------------------------------------
> 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
--
Regards,
Demosthenes Koptsis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.tar.gz
Type: application/x-compressed-tar
Size: 8714 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110119/9b90049a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .MyLog.txt.tar.gz
Type: application/x-compressed-tar
Size: 194 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110119/9b90049a/attachment-0001.bin>
More information about the User
mailing list