8 ms·
How is it dated? That's how the Python logging library works, that's how Go's `slog` package works, that's how most of Rust's structured logging crates works.
by linkdd 3y ago
How is it dated? That's how the Python logging library works, that's how Go's `slog` package works, that's how most of Rust's structured logging crates works.
I guess the definition of "effortless" varies from people to people, I find this "no hard setup required" way to be effortless.
- gpderetta 3y agoIt is a bit verbose. Could you allow a syntax like: logger.log_error("internal server error", {{"http.method", "GET"}, {"http.path", "/"}, {"http.status", 500}} );
- linkdd 3y agodebug/info/warn/error methods are coming. For the latter, since I use a pack expansion ( `...` ) of `field<T>`, maybe it is already possible to omit the type name. I shall put that in a test case and update the README :) Thank you for the feedback.
- gpderetta 3y agoNot sure you can do it with a pack expansion. You can do it by taking an initializer_list<logfmtxx::field> though. edit: example: https://gcc.godbolt.org/z/dK7Tq6hja https://gcc.godbolt.org/z/dK7Tq6hja