Display / Emit Logs in Algorand SmartContract

How to print/emit logs in Algorand SmartContract.

This is how I’m doing it:

    def staked(token, requested_amount, staked_amount):
        return Log(Concat(Bytes("staked { token: "), convert_uint_to_bytes(token), Bytes(", requested_amount: "), convert_uint_to_bytes(requested_amount), Bytes(", staked_amount: "), convert_uint_to_bytes(staked_amount), Bytes("}") ))

staked(App.globalGet(staking_token), amount, remaining_token.load()),

But it doesn’t work

Normally, you should see emitted logs in the indexer response: both in the transaction themselves (indexer - Algorand Developer Portal) and also in the endpoint GET /v2/applications/{application-id}/logs.

You should also see the log events after the transaction is confirmed in the transaction pool.
See demo-avm1/log at main · algorand-devrel/demo-avm1 · GitHub for a full example.

If this solves the issue, please explain the changes you made as a response to this post.

If this does not solve the issues, can you write a minimum example with the Log function that does not work for you?
That is, a full PyTEAL script but that only does the Log.
And then run it on TestNet and show the issue (give us the transaction ID).