log(comments)

ilan

Expert
Licensed User
Longtime User
do you remove your logs (comments) after you finish the app and upload it to the store?
actually, i don't. so you may run my apps while plugged into b4a and see lots of weird logs in the console.

the reason i just am thinking about it is, I have started a few days ago a web development course (HTML, CSS, js,...)
and I am using Chrome to inspect some sites to see how people build their sites and it is funny you can find lots of log like:

//alert("ggg")
or <!-- This is a workaround -->>
and many more.

i use a lot of logs to check if something is working or not. i know there is a way to exclude them from the build but i don't put too much effort into it. how about you?

i hope i removed all logs saying:
log("this line will steal all information of the user") ... ?
 

LucaMs

Expert
Licensed User
Longtime User
I have a plugin which removes all logs and comment lines at compilation time. I just compile my projects pressing CTRL+SHIFT+ALT+F5.

1610636544263.png
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
I try to, but still end up chasing my tail when looking for a log that is generated 3 libraries deep.
 

Cableguy

Expert
Licensed User
Longtime User
Personly I would prefer that a new log statement existed, like "log2", that was persistent, and the normal log to be automatically ignored by the compiler in release mode...
Logs are useful not only to debug but also to "breadcrumb" your way back to an app that has been sitting for too long, or even just to port between versions... I for one am unable to recall why I coded "this way" an app done 6 months ago!
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
' Will write the Text only if the conditional symbol is not set (DEBUG by default).
' Params: pass Null if not needed.
' Crl: Text color - B4A only.
Public Sub Logs(Text As String, Params As List, Clr As Int)
    #IF DEBUG
        #IF B4A
            LogColor(Text, Clr)
        #ELSE
            Log(Text)
        #End If
        If Not(Params.IsInitialized) Then Return
        For i = 0 To Params.Size -1
            #IF B4A
                LogColor(TAB & Params.Get(i), Clr)
            #Else
                Log(TAB & Params.Get(i))
            #End If
        Next
    #End If
End Sub

Using this routine (put it in a code module or create a class-library) you would lose the possibility that the IDE has to take you to the Log line, but you can pass the line number as a parameter, together with the name of the module, the name of the routine and whatever else you want.
 
Top