David Martinez Member Licensed User Longtime User Feb 7, 2017 #1 Curious performance question.... What happens to "Log" methods during compilation in Release mode? Should I comment them out, removed them or ignore them before I compile a final release? Thanks
Curious performance question.... What happens to "Log" methods during compilation in Release mode? Should I comment them out, removed them or ignore them before I compile a final release? Thanks
DonManfred Expert Licensed User Longtime User Feb 7, 2017 #2 Logs stay in your app if you don´t limit them to DEBUG or RELEASE Code: Copy #if debug Log("log only in debug mode") #end if #if release Log("log only in release mode") #end if Upvote 0
Logs stay in your app if you don´t limit them to DEBUG or RELEASE Code: Copy #if debug Log("log only in debug mode") #end if #if release Log("log only in release mode") #end if
David Martinez Member Licensed User Longtime User Feb 7, 2017 #3 Thanks DonManfred. I will wrap them all. Upvote 0
Jeffrey Cameron Well-Known Member Licensed User Longtime User Feb 7, 2017 #4 For what it's worth, I create two subs in every project in my main module and call them: Code: Copy Public Sub MyLog(Text As String) #If DEBUG LogColor(Text, Colors.Magenta) #End If End Sub Public Sub MyLogError(Routine As String, Text As String) LogColor("Source: [" & Routine & "] Error:" & Text, Colors.Red) End Sub That way, in my code I can use module.MyLog(...) for debugging and module.MyLogError(...) for log statements I want regardless of which mode I'm in. See this discussion for more information:https://www.b4x.com/android/forum/threads/programatically-check-for-debug.30296/#post-175950 Upvote 0
For what it's worth, I create two subs in every project in my main module and call them: Code: Copy Public Sub MyLog(Text As String) #If DEBUG LogColor(Text, Colors.Magenta) #End If End Sub Public Sub MyLogError(Routine As String, Text As String) LogColor("Source: [" & Routine & "] Error:" & Text, Colors.Red) End Sub That way, in my code I can use module.MyLog(...) for debugging and module.MyLogError(...) for log statements I want regardless of which mode I'm in. See this discussion for more information:https://www.b4x.com/android/forum/threads/programatically-check-for-debug.30296/#post-175950