rustler
rustler copied to clipboard
println! with iex -S mix produces poorly formatted output

It looks like this basically.
Not much we can do about this I believe.
An alternative would be to introduce a new printing function in rustler that uses the BEAM provided printing functions.
Relevant: https://github.com/rusterlium/rustler/issues/72
There is this, which could enable us to change where the default rust print functions send their outputs. This seems to be what the rust test framework uses.
The issue is I don't think there is any way for us to statically execute code on every scheduler thread, so I don't think we can actually use this.
https://github.com/rust-lang/rust/blob/db15596c5747eed0344f2622a9d85ad9534b23f9/library/std/src/io/stdio.rs#L934-L963
FWIW, I've had pretty good luck using env_logger: https://github.com/scrogson/franz/blob/master/native/franz/src/lib.rs#L12
The set_print is also unstable. Maybe we should just document that using print! etc. is a bad idea and people should use the log crate instead.
I am using the env_logger crate and am still having this behavior. Is this expected? (ie does this issue go deeper into the rust/erlang logging interaction). If its not expected, is there a code example that might be able to get logging output without the extra spaces? Are there any known workarounds? (for example syslog)