marty Professional Member
Joined: 10 May 2001 Posts: 789
|
Posted: Thu Mar 21, 2002 6:53 pm Post subject: DEBUG Mode idea for developpers of VDS apps |
|
|
In the VDS application I,m currently building (VDSWORLD Media Player), I added a Debug mode to it. What it does it simply logs every action/function in a list while the app is running. That way if your VDS app stops because of an error a log file is saved with all the action the users did and could send it to you in order for you the VDS developper to easily debug your app. Well I use for my self while testing. Cause I know sometimes we forget how we caused the error. Since my primary job is Software Quality Assurance developpers always asks us to reproduce a certain bug or simply look in a log file. Anyways hope it will help somebody.
Example:
Code: | Title My app
%%debugmode = on
option errortrap,errorsection
if @equal(%%debugmode,on)
list create,16
%%trace = @datetime(hh:mm:ss) Initializing My app
gosub trace
end
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) Initializing myapp variables
gosub trace
end
%%somevariable = whatever
:Creating Interface
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) Creating main interface
gosub trace
end
DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG ADD,BUTTON,OK,104,40,64,24,OK
DIALOG ADD,BUTTON,Cancel,104,136,64,24,Cancel
DIALOG ADD,BUTTON,Error,54,82,64,24,Error
DIALOG SHOW
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) Entering the event loop
gosub trace
end
:Evloop
wait event
goto @event()
:OKBUTTON
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) OK button has been clicked
gosub trace
end
info Replace this line with code to process the OKBUTTON event
goto evloop
:errorBUTTON
rem generates an error
goto whatever
:CancelBUTTON
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) CANCEL button has been clicked
gosub trace
end
info Replace this line with code to process the CancelBUTTON event
goto evloop
:Close
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) Exiting My app
gosub trace
end
list savefile,16,debug.log
list close,16
shell open,debug.log
exit
:errorsection
if @equal(%%debugmode,on)
%%trace = @datetime(hh:mm:ss) MyApp got an error @error(E) on line @error(N)
gosub trace
list savefile,16,debug.log
list close,16
shell open,debug.log
end
warn An error @error(E) on line @error(N) has occurred.@cr()Please send this information to support.
exit
:trace
list add,16,%%trace
exit |
I don't know if it's the best way but it works for me...
Any suggestions are welcome...
Marty |
|