auto merge of #5278 : brson/rust/logplusplus, r=brson
r?
`log` can polymorphically log anything, but debug!, etc. requires a format string. With this patch you can equivalently write `debug!(foo)` or `debug!("%?", foo)`.
I'm doing this because I was trying to remove `log` (replacing it with nothing, at least temporarily), but there are a number of logging statements that just want to print an arbitrary value and don't care about the format string.
I'm not entirely convinced this is a good change, since it overloads the implementation of these macros and makes their usage slightly more nuanced.
This commit is contained in:
commit
eaed16cea6
2 changed files with 42 additions and 8 deletions
10
src/test/run-pass/log-poly.rs
Normal file
10
src/test/run-pass/log-poly.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
enum Numbers {
|
||||
Three
|
||||
}
|
||||
|
||||
fn main() {
|
||||
debug!(1);
|
||||
info!(2.0);
|
||||
warn!(Three);
|
||||
error!(~[4]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue