Hacker News new | ask | show | jobs
by wokwokwok 2579 days ago
Did something change, or is log not still a global singleton that you register, like you would in go, for database drivers?

The macros are nice and all, but I’m pretty sure the author of log went out and said, yeah well, but you’d disable this in production, because it’s slow and all.

Am I wrong?

Did something change?

You certainly didn’t used to be able to have two different log implementations active in different contexts.

1 comments

> The macros are nice and all, but I’m pretty sure the author of log went out and said, yeah well, but you’d disable this in production, because it’s slow and all.

You can target code to be executed in debugging vs. production in Rust. So you can have two logging: one for production and one for debugging.

Even better, if you propagate errors back to the top of your program, you'll only have one line for logging for production and the informational logs will remain for debugging only.