Closed BearzRobotics closed 6 years ago
This is more an issue of log
s usability, then of this crate, but since your error is very obvious, let me help you quickly:
error!
, warn!
, info!
, etc all accept arguments, just like println!
or format!
from the standard library. You can read more about formatting in the documentation of std::fmt.
In your case, what you would want to write is: info!("{}", file_vec[i]);
, if the elements in your array do implement Display
or info!("{"?}", file_vec[i]);
, if they implement Debug
. Note that not every variable is loggable by this definition, but you can usually just #[derive(Debug)]
to make them "loggable" (or better "format-able").
Sorry for getting back to this so late.
So write now I have it working were I can do info!("Some text");, but when I try and put a variable in here it won't compile. I have a vec that reads paths from a file, then it manipulates them and then deletes the paths. I want it to log the value of each vec[i] when going through a for loop. So you can have a list of the final paths that it tried to delete and weather it was successful full or not.
error: format argument must be a string literal. --> src/main.rs:92:9 | 92 | info!(file_vec[i]); | ^
error: aborting due to previous error