LibAFL
LibAFL copied to clipboard
Use log fascade
I think LibAFL could benefit from a generic logger as there are quite some messages which are sent to stdout.
env_logger allows to configure logging externally and uses macros for the actual calls. This is similar to println!.
I do not have experience with Rust, but enjoyed to work with env_logger. I suppose this is the default in the Rust community atm.
What do you think? Does it make sense to switch to this? Or do we plan to avoid all logging and have a slick tui like AFL++?
Actually you can already do it because SimpleStats and MultiStats use a closure to print logs
I think that a proper logging library would be very useful. If possible, it should prefix output with a date/time-stamp and a thread/process id...
I think if we can make sure libafl does not output to stdout/stderror itself, but everything goes through the Stats, then we do not need to depend on the crate log.
There are some calls to println! though: https://github.com/maxammann/LibAFL/blob/2f54e9dc01b5846ab3542d24721758a1f02239ff/libafl/src/events/llmp.rs#L742
I see two options:
- move all println! output to Stats
- Add
logdependency and letlogcoexist with the Stats
What do you think?
I'm refering to the log fascade log here: https://crates.io/crates/log
I'm refering to the log fascade
loghere: https://crates.io/crates/log
Yes I like it is it no_std too
For me, Stats are output for the user during fuzzing, logs should be mostly for debugging and development. Makes sense to have both. :)
I think a proper logging crate is definitely necessary.
Can we think of a way to date/time-stamp and process-id-stamp the dup2-ed output from launcher when --output is used? Is there some kind of 'magic stream' that will automatically do it for us?
Done with #1060