Debug log file
Posted: Sun Aug 03, 2008 11:12 pm
How many of us wished they could have a log that they could look through when they wanted instead of after every compile. This procedure does just that 

Code: Select all
;
; DebugSystem.pbi - Copyright ©EdzUp
; Coded by Ed Upton
;
Global DebugFileName.s = "DebugLog.txt"
Declare AddLog( StringToAdd.s )
Procedure AddLog( StringToAdd.s )
Static FileHandle.l = 0
FileHandle = OpenFile( #PB_Any, DebugFileName ) ;open or create a file
If Not FileHandle
MessageRequester( "DebugLog Error", "Could not access file "+DebugFileName )
End
EndIf
FileSeek( FileHandle, Lof( FileHandle ) ) ;seek to the end
WriteStringN( FileHandle, StringToAdd ) ;write out the string to the file
CloseFile( FileHandle ) ;close the file afterwards
EndProcedure