Anvil Community Forum

Add logging of all round trips

I always log my http endpoints and my server calls with something like this:

@anvil.server.callable
def get_project(project_number, release_number):
    print(f'get_project({project_number}, {release_number})')

If the user opens a form or clicks on a button that requires updating both a label and a repeating panel, and each update makes server call, I see the two calls being logged and modify the logic so there is only one roundtrip to fetch both label and repeating panel content in one shot.

This helps me making sure I have only one roundtrip for every user interaction (when a form loads or when the user clicks somewhere).

I can see all my calls to the server because I log them, but unfortunately I don’t see the roundtrips caused by data table rows or iterators that lazily fetch some data.

I would like to see something like:

image

Here in orange the prints from the server, in blue the prints from the client and in green the prints from any roundtrip caused by any Anvil magic.

The app or the environment should have some setting that lists what needs to be logged.

This would help me keeping my apps lean and zippy, and the beginners understanding what’s going on under the hood.

2 Likes