openlawlibrary / stelae

Preservation, Authentication, Access
GNU Affero General Public License v3.0
7 stars 1 forks source link

Set up logging #4

Open dgreisen opened 1 year ago

dgreisen commented 1 year ago

We've seen how difficult it is to use our current ad hoc logs. So I think this is something that is worth doing right.

actix uses logger: https://actix.rs/docs/middleware/#logging blessed recommends tracing: https://blessed.rs/crates#section-common-subsection-logging actix middleware for tracing: https://docs.rs/tracing-actix-web/latest/tracing_actix_web/ explanation of theory behind tracing: https://www.lpalmieri.com/posts/2020-09-27-zero-to-production-4-are-we-observable-yet/

@tombh - do you have any experience with logging?

tombh commented 1 year ago

Yes, in my last Rust contract we used tracing in a web server. It's pretty straight forward to get started. The difficult bit was getting performance tracing "spans" inside the middleware. Such performance logging can be useful for event reporting, for example: notify admin when a request takes longer than 5 seconds.

I could make a "getting started" PR for tracing?

dgreisen commented 1 year ago

@tombh that would be excellent, thank you!