This custom logging solution allows you to log messages as usual, but some logging severities have special behaviour, allowing to trigger execution stop or check for error.
I started developing it as part of solution for my m15Model project, but it is independent and can be used in any application.
Log007 is provided with full source code and unit tests here:
https://github.com/petrSchreiber/Log007
The official documentation and example of use is available at Wiki.
The latest release is available for download.
Just to give idea:
Uses "file"
#INCLUDE "log007.tbasicu"
Global agent As Log007("log.txt")
Function TBMain()
agent.Note("debug", Function_Name, "Program started")
String buffer = LoadData("C:\Not\Really\Existing.txt")
If agent.InTrouble Then
MsgBox 0, agent.LastTrouble
Else
MsgBox 0, buffer
End If
End Function
Function LoadData(fileName As String) As String
If FILE_Exists() Then
Return FILE_Load(fileName)
Else
agent.Note("error", Function_Name, "Could not locate " + fileName)
End If
End Function
Produces this log file:
03-26-2016 19:43:49 (DEBUG) [TBMAIN] Program started
03-26-2016 19:43:49 (ERROR) [LOADDATA] Could not locate C:\Not\Really\Existing.txt
Petr
Bookmarks