.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.
Replace all usages of .to_c_str().with_ref() with .with_c_str().
The truncation needs to be done in the console logger in order
to catch all the logging output, and because truncation only matters
when outputting to the console.