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

https://www.b4x.com/android/forum/threads/b4a-automatic-insertion-of-log-statements.47464/

upload_2014-12-5_12-41-42.png


It is not free but it costs a few dollars.
 

Attachments

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

LucaMs

Expert
Licensed User
Longtime User
However, 281 people have read this thread (at least the first post).
They did not leave a comment.

The next tool will not be free, it will cost € 15.

An example of the usefulness of this tool.
This code was published today:
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


All those "# IF Debug - End If" are not required, using the tool; just set the LogOn variable to False or True!

In addition, the internal lines were written by hand, in that code.
The tool inserts them automatically.

I was thinking of modifying the tool, so that it allow the user to insert custom code.

But given the results, not worth it.
 
Last edited:

RauchG

Active Member
Licensed User
Longtime User
But I can not see what is wrong if you do not publish even the routine (yours) where it occurs.

as you can see in the screenshot, the error message is already in your run "AddLogs.exe". When I look at my code, the module for "modMyUtils" was not created.

The idea for the "logs" is very good and I pay discounts for 10 € if it runs correctly.

I have sent you my project as an e-mail. Did not you get it? Drag the folder on your program and you see the error the same.
 

RauchG

Active Member
Licensed User
Longtime User
as you can see in the screenshot, the error message is already in your run "AddLogs.exe". When I look at my code, the module for "modMyUtils" was not created.

The idea for the "logs" is very good and I pay discounts for 10 € if it runs correctly.

I have sent you my project as an e-mail. Did not you get it? Drag the folder on your program and you see the error the same.

Sorry. 15€
 

klaus

Expert
Licensed User
Longtime User
Well, you are expecting votes and comments.
The only voter till now that's me.
My comment, I won't use it.
When I debug a program I put Logs in the area where I have a problem and solve it.
Once the problem is solved I remove the Logs, I have no reason to leave them in there?
 

LucaMs

Expert
Licensed User
Longtime User
Well, you are expecting votes and comments.
The only voter till now that's me.
My comment, I won't use it.
When I debug a program I put Logs in the area where I have a problem and solve it.
Once the problem is solved I remove the Logs, I have no reason to leave them in there?

In fact, I thank you for the vote, Klaus.

(The tool removes all ITS Log lines automatically ;))

I could add another variable, to condition the log, so you can have the logs "mandatory" and the optional.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
as you can see in the screenshot, the error message is already in your run "AddLogs.exe". When I look at my code, the module for "modMyUtils" was not created.

The idea for the "logs" is very good and I pay discounts for 10 € if it runs correctly.

I have sent you my project as an e-mail. Did not you get it? Drag the folder on your program and you see the error the same.


I can not run your project because I have the version 3.00 of B4A.
I'm sorry.
 

LucaMs

Expert
Licensed User
Longtime User
I'm not a very good programmer but mostly I'm stupid.

If I had sold this tool for €5, I would have gained a few hundred euro, probably.

I would do a Christmas present to myself.

Well, I did the Christmas present to the members of the site :)
 
Top