Stream: t-libs

Topic: log crate levels


gnzlbg (Jan 11 2020 at 15:51, on Zulip):

Is there a resource somewhere explaining how to meaningfully use the log crate levels ?

gnzlbg (Jan 11 2020 at 15:51, on Zulip):

Or some kind of guidelines ?

gnzlbg (Jan 11 2020 at 15:52, on Zulip):

When debugging large applications with many crates it is kind of apparent that some crates use debug! for what should probably be info!, others use debug! for what should probably be trace!, and the best solution is to just output trace!s and above and hope for the best.

gnzlbg (Jan 11 2020 at 15:53, on Zulip):

In particular, there does not seem to be a distinction between "debug log for somebody working on improving the current crate" and "debug log for somebody using this crate somewhere"

gnzlbg (Jan 11 2020 at 15:53, on Zulip):

Unless that's what the distinction between debug! and trace! is, but the docs don't really say anything about how the different levels should be used.

simulacrum (Jan 11 2020 at 15:56, on Zulip):

I personally have always considered the levels to essentially correspond to -v levels on the command line, so, essentially app-specific and largely not "meaningful"

simulacrum (Jan 11 2020 at 15:56, on Zulip):

i.e., there's not any particular notion of "this is what goes in which"

gnzlbg (Jan 11 2020 at 16:04, on Zulip):

Using names like debug, error, warn, info and trace does suggest a meaning

gnzlbg (Jan 11 2020 at 16:05, on Zulip):

but I personally just always log everything, and try to filter it afterwards

gnzlbg (Jan 11 2020 at 16:05, on Zulip):

because of the problems above

gnzlbg (Jan 11 2020 at 16:05, on Zulip):

I think the distinction between "relevant for people developing this crate" and "relevant for people using this create" is useful

gnzlbg (Jan 11 2020 at 16:06, on Zulip):

When using hyper I get a lot of logs about 7 bytes read here, written there, etc. when I usually only care about which http requests were performed

simulacrum (Jan 11 2020 at 16:25, on Zulip):

Yes, I think there is potential for meaningful assignment -- but I'm saying that that assignment is library-specific

simulacrum (Jan 11 2020 at 16:26, on Zulip):

(at least currently)

gnzlbg (Jan 11 2020 at 16:27, on Zulip):

Ah I fully agree, that's the issue I'm trying to raise

simulacrum (Jan 11 2020 at 16:28, on Zulip):

I'm not sure if I agree that I'd want to change that either :)

Or at least it seems like we'd rather want an orthogonal flag

simulacrum (Jan 11 2020 at 16:29, on Zulip):

i.e., for developer/for end user of library is orthogonal to the logging level, it feels like

gnzlbg (Jan 11 2020 at 17:01, on Zulip):

maybe

gnzlbg (Jan 11 2020 at 17:01, on Zulip):

that makes sense to me

Last update: Jul 02 2020 at 12:40UTC