Debug-via-print pattern on axum

Trying to support a team migrating from other languages (php, jvm) where our systems used to prepend time and request id to all output generated by a backend code.

It made filtering a request on the logs very convenient.

I've added a trace layer to axum but that only prepends the information on things generated by axum.

Is there a pattern i can use to have anything outputted by the route handler also be prefixed?

Everything? No. But you can create spans whenever you want an action to be traced.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.