cloud-hypervisor / fuse-backend-rs

Rust crate for implementing FUSE backends
Apache License 2.0
130 stars 65 forks source link

fix some log noise #195

Open flokli opened 3 months ago

flokli commented 3 months ago

This downgrades two of the info! level log messages to debug.

They becomes quite noisy if fuse-backend-rs is used as a library. Logging it at debug! keeps them silent until log levels are increased.

imeoer commented 3 months ago

It make sense, perhaps we can provide these info by other method?

flokli commented 3 months ago

You mean, you'd be fine to merge this in case there's ways to get out major, minor, capable, enabled as a consumer of the library, so you can log them out there?

If so, any preferences on the API?

major, minor already are constants:

major: KERNEL_VERSION,
minor: KERNEL_MINOR_VERSION,

... and stored in self.vers.

want is coming from the flags in passed by the user (so probably possible to calculate statically). The enabled flags are already available in InitOut, so maybe they can be stored in self too?

flokli commented 3 months ago

Hmmh, passing these flags up requires touching a lot of things. No code is arguably having a use for these values (otherwise it would have been exposed already), and the only usecase would seems to be logging it to the user (when they're /debugging/ fuse-backend-rs) so I'm thinking increasing the log level in that case is the right call.

The current situation causes every user of the library to get these log statements printed out to their CLI users, even if everything is fine. At least if the binary doesn't do some extra work on explicitly filtering out info log messages for the fuse-backend-rs crate.

Another example: A HTTP client library also doesn't print the source port it uses for the outgoing TCP connection whenever it opens one, at least not in the info/default log level. If users want (and use it in a log framework that allows crate-level log levels), they can crank up the debug level on that specific crate.

imeoer commented 3 months ago

Indeed, should avoid output info level logs within a lib, but it's hard to change the log level to debug issue in production, maybe we can store pub capable in self? WDYT cc @jiangliu @bergwolf

flokli commented 1 day ago

Poke :-) Any chance we can land this?