Sub Main
Activity.LoadLayout("main")
MyLog("Main Activity Loaded", Colors.Black)
End Sub
Sub MyLog(LogMessage As String, LogColor As Int) As String
Dim CL As Object
Dim LT As String
Dim L As String
CL = #CallingCodeLine 'I am saving the original line number here in case this sub needs to call other subs which would update the @CallingCodeLine value and overwrite the original line number
LT = LogTime
L = LT & ": " & LogMessage
'here you can save L to disk so remote users can submit the log file(s) for diagnostics
LogColor(L, LogColor, CL) 'CL contains caling line number so "Click to go to code" will properly go to line "3" in above sub "Main"
'which will create a log entry like: "03:34:92.1356 Main Activity Loaded"
End Sub
Sub LogTime() As String
'display high-precision time format for benchmarking/performance purposes
'ex. "03:34:92.9302 This is the log message"
Dim L As String
Dim M As Long
Dim N As Long = DateTime.Now
M = (DateTime.GetHour(N) * DateTime.TicksPerHour) + (DateTime.GetMinute(N) * DateTime.TicksPerMinute) + (DateTime.GetSecond(N) * DateTime.TicksPerSecond)
L = Pad(DateTime.GetHour(N),2,"0") & ":" & Pad(DateTime.GetMinute(N),2,"0") & ":" & Pad(DateTime.GetSecond(N),2,"0") & "." & Pad(N-M,4,"0")
Return L
End Sub