rust-vmm / vmm-reference

A VMM implementation based of rust-vmm components
Apache License 2.0
146 stars 61 forks source link

Use log instead of println!/eprintln! #79

Open andreeaflorescu opened 3 years ago

andreeaflorescu commented 3 years ago

Import the log crate and use it to log needed information.

For now it should be enough to just replace the existing println! or eprintln!.

tumbleshack commented 3 years ago

Hey!

My friend @seanmichwalsh and I are looking to learn about VMM's and Rust. Mind if we take on this issue?

It may take us a bit to learn our way around if that's okay with you.

andreeaflorescu commented 3 years ago

Sure @tumbleshack , sounds good. If you need any help, let us know.

You can also find us on Slack: https://join.slack.com/t/rust-vmm/shared_invite/enQtODAxMzA2ODIyMTc2LWRhYjIwZmQ0YzUxODJlMTRhZWU2ZDBjYmJiNzBmOWVmYjg4MjY5YWRjYjM0YzQ5YzgyMTBmYzNlMjMzYmZlODU

dodsonmg commented 2 years ago

Is this still open? I'm happy to pick up where #114 left off...

andreeaflorescu commented 2 years ago

@dodsonmg yes, this is still opened. We should though reduce the scope for the beginning so that's easier to get it merged. We can do this initially for the main.rs, and the vmm and api crates.

dodsonmg commented 2 years ago

Cool. Thanks @andreeaflorescu. I'll pick it up.

dodsonmg commented 2 years ago

Do you want the log level and log file to be command line arguments, or do you just want default log level settings and log output to go to stderr?

If the former, the log level and file can't be established until we've processed command line arguments, and we'll miss some of the println! and eprintln! statements that come before then. This is how cloud hypervisor does it.

If the latter, then I think we can just initialise the logger first and sweep everything up.

andreeaflorescu commented 2 years ago

I think how it worked in Firecracker is that we were using println and eprintln until the logger is initialized, and error info afterwards. This way you don't loose any logs because you're redirecting the output to a file anyway. I think we could start with something simple where we assume stdout and stderr because I believe these can also just directly be forwarded to files without us doing anything special in the VMM code.