How does IC gracefully record the logs in the container

After I have checked, I have not found a more suitable way to record and query the logs in the container out of the box.

What I envision is how to put the container’s

ic_cdk::println("xxxxxxxx"); // such messages are written to a storage

Use dfx log canister_id [if any] or provide an interface to output the log according to the execution flow

1 Like

I don’t know of a nice way at the moment, but I could see someone write a pretty simple library for a start. In one of my canisters I just made a ring buffer and whenever I want to log something I write it there, and then I can query for the last n log statements

2 Likes

Do you have an example of a simple implementation of this in Rust?