Wish Mark lines to show in log when executed

MikeH

Well-Known Member
Licensed User
Longtime User
Instead of typing:
B4X:
Log ("Whatever code is at this line")
to show in the logs when that line of code is executed:

For example

Screenshot 2022-01-28 at 17.55.13.png


Would it possible to implement this?

Screenshot 2022-01-28 at 17.59.06.png


by adding a marker like this:

Screenshot 2022-01-28 at 18.07.11.png


Then we can quickly mark/unmark lines that we want to see executed.
Like breakpoints, it could be called logpoints.

Thank you for your hard work already, Erel

Regards,
Mike.
 

Attachments

  • Screenshot 2022-01-28 at 17.55.13.png
    Screenshot 2022-01-28 at 17.55.13.png
    14.5 KB · Views: 132
  • Screenshot 2022-01-28 at 17.59.06.png
    Screenshot 2022-01-28 at 17.59.06.png
    8.4 KB · Views: 131
  • Screenshot 2022-01-28 at 17.55.13.png
    Screenshot 2022-01-28 at 17.55.13.png
    14.5 KB · Views: 138
Last edited:

JohnC

Expert
Licensed User
Longtime User
That's a cool idea!

Makes it real easy to place a bunch of log entries when debugging an area of code instead of manually having to type each one.
 

JohnC

Expert
Licensed User
Longtime User
I think it's unlikely. Perhaps it would be possible to have the editor generate the code line for the log upon clicking on the line (simultaneously with pressing one of the special keys, of course).
But to remove all those "generated text" log lines, you would have to do a bunch of keystrokes - Imagine if "break" lines worked that way - in which they were easy to add by pressing a special key to inserting the text "Break-Here" in the code, but then you had to manually remove each of those "Break-Here" text lines from all the spots in the code you put there when you were debugging it - it would be very tedious.

That's why the current way of adding and removing breakpoints is so convenient because you don't have to type or untype anything.

With the OP's idea, you can add and remove these "temp" log lines quickly and easily (just like adding a breakpoint) and maybe there could even be a toolbar button or menu selection that would remove all the "temp" log lines at once from the code (of course any regular/manually added "Log(xxxxx)" code lines would remain)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
But to remove all those "generated text" log lines, you would have to do a bunch of keystrokes - Imagine if "break" lines worked that way - in which they were easy to add by pressing a special key to inserting the text "Break-Here" in the code, but then you had to manually remove each of those "Break-Here" text lines from all the spots in the code you put there when you were debugging it - it would be very tedious.

That's why the current way of adding and removing breakpoints is so convenient because you don't have to type or untype anything.

With the OP's idea, you can add and remove these "temp" log lines quickly and easily (just like adding a breakpoint) and maybe there could even be a toolbar button or menu selection that would remove all the "temp" log lines at once from the code (of course any regular/manually added "Log(xxxxx)" code lines would remain)
Sure, I know it would be better as requested but I'm afraid it's a lot less easy to make it that way.
 

JohnC

Expert
Licensed User
Longtime User
Sure, I know it would be better as requested but I'm afraid it's a lot less easy to make it that way.
But think of it this way - when we click to the left of a line in the IDE to mark a breakpoint line, the IDE is inserting some hidden code on that line when it is compiled - but yet the user does not see this hidden code - all they see if the red circle to the left of the line.

I'm thinking that these "temp log points" could just as easily be inserted as hidden code by the IDE when the user clicks a line and a special key to mark that line - and all the user will see is new special icon to the left of the line they marked - but when the compiled code reaches that line, the hidden code would post the log text to the event log list.
 
Last edited:

William Lancee

Well-Known Member
Licensed User
Longtime User
This feature would be especially useful since we now have the ability to click on the log arrow and jump to the code that generated the log.
I do use the technique below but an automatic approach would save a lot of time.

B4X:
trace = true        'this is a global

'I put the following comment at the start of the code where I can find it
'Then I cut the line before the colon and paste at the end of the code line I want to log (this preserves the line numbering and works in most situations)

': If trace Then Log(99)

'for example:

141     height = 5.9: If trace Then Log(141)

'To quiet the whole trace set trace = False
'To remove them, search for "If trace"
 
Top