AddLogs: B4A / B4J / B4I - Automatic insertion of log statements

LucaMs

Expert
Licensed User
I have developed a useful tool for debugging B4A / B4J / B4I projects (it is a sw for windows) which:

adds to each project selected a small module that contains a routine for logs (it can be turned off);

adds to each routine a few calls to the log:
the first one shows the name of the module that contains the routine and the routine name (when the routine will be executed, of course);
some other show the parameters values.

Before (Activity name: actTwo):
upload_2014-11-26_17-0-15.png



After (Activity name: actTwo):
upload_2014-12-5_13-27-9.png

(LogColor used in B4A projects)


(The purpose of using the MyLog routine instead of Log is that it can be simply disabled by setting a global variable in the modMyUtils module).


No more hand written code like this (also no more need of "#IF Debug" structure)
B4X:
#If Debug
     Log("Btn.Tag: " & Btn.Tag)
#End If
     tmpString = tmpTag.Replace("OnLongClickSub","#")
#If Debug
     Log("tmpString1: " & tmpString)
#End If
     tmpString = tmpString.SubString(tmpString.IndexOf("#")+2)
     tmpString = tmpString.SubString2(0,tmpString.IndexOf(","))
#If Debug
     Log("tmpString2: " & tmpString)
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here there is a chr10 (LF) at end
#End If
     tmpString = tmpString.Replace("_LongClick","")
#If Debug
     Log("tmpString2: " & tmpString)
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here the same chr10 at end also, any test you do with the variable tmpString after don't work.
     ' See the log attached
     ' I don't know if it's due to SubString2 or Replace  but with Android 4.x i haven't this problem before.
#End If
     tmpString = tmpString.Trim             ' <- ' I have add this and that's work now
#If Debug
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here nothing more than the SubString who is needed.
     Log("Sender: " & tmpString)
#End If


Version: 2.0
upload_2014-12-5_12-37-9.png


It is not free but it costs a few dollars.


Version: 2.1
Added a function just to get a list of all modules and routines. See this post.
 

Attachments

  • AddLogs20_Setup.zip
    407.3 KB · Views: 193
Last edited:

erosmax

Well-Known Member
Licensed User
Nice Work, Luca. ;)
I hope when this tools become a must in B4A :D
 

LucaMs

Expert
Licensed User
Soon Version 2.00

It will work with B4A-B4J-B4I.

Also, you will be able to insert you own multiline text for the logs (with placeholders for ModuleName [Classes-Code-Services], RoutineName, ParameterName inserted using buttons).

I'm thinking to sell it for only $450.592.520 but maybe I'll do a discount :D


[I forgot: I will publish it only when I read some: +1 ]
 

LucaMs

Expert
Licensed User

It would seem that the tool does not interest anybody.
It would seems!

(We all use the logs to find errors and an automatic insertion that, moreover, prevents typing errors, I do not believe that it has been downloaded by few people).

However, when version 2.0 will be completed (if I will complete it, because now I will work much for another project) it will be almost free: € 6.49!
 

Peter Simpson

Expert
Licensed User
I played about with V1.24. I think that it's a good tool and a nice companion, but I only played about with it for 5 or so minutes. Until I do updates or a new project, I can't really say much. I do like it though and I will really be able to give it a good going over with V1.24 next week :)

I will not be developing on B4i, and I only test with B4J,
 

LucaMs

Expert
Licensed User
My fault.

Initially I had no attached the file, I thought to send it via email, but it can be rejected by mail servers; this is why I have not explained it here.

Download the zip file, unzip it, install the program and launch it.

You will see a window that warns you that the sw is not registered and that displays a "Customer reference".

Send that "Customer reference" code to me and then I'll send you the "Serial Key" for activation.
 
Top