diff options
| author | bors <bors@rust-lang.org> | 2013-09-26 17:11:13 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-26 17:11:13 -0700 |
| commit | 1434b4bfcafe90cffa6627e3be18a9e5b6501ad1 (patch) | |
| tree | e6d20bd6e26d0eec5ed93898170b0a48d5194711 /src/libsyntax/ext | |
| parent | 48499c7494d47f505a640157816cea2690b8d407 (diff) | |
| parent | eb2b25dd6d38157213742b048fad63fa4ceec691 (diff) | |
| download | rust-1434b4bfcafe90cffa6627e3be18a9e5b6501ad1.tar.gz rust-1434b4bfcafe90cffa6627e3be18a9e5b6501ad1.zip | |
auto merge of #9261 : alexcrichton/rust/logging, r=huonw
This lifts various restrictions on the runtime, for example the character limit when logging a message. Right now the old debug!-style macros still involve allocating (because they use fmt! syntax), but the new debug2! macros don't involve allocating at all (unless the formatter for a type requires allocation.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 61c9ea7be14..9771f7dadca 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -813,13 +813,17 @@ pub fn std_macros() -> @str { ($lvl:expr, $arg:expr) => ({ let lvl = $lvl; if lvl <= __log_level() { - ::std::logging::log(lvl, fmt!(\"%?\", $arg)) + format_args!(|args| { + ::std::logging::log(lvl, args) + }, \"{}\", fmt!(\"%?\", $arg)) } }); ($lvl:expr, $($arg:expr),+) => ({ let lvl = $lvl; if lvl <= __log_level() { - ::std::logging::log(lvl, fmt!($($arg),+)) + format_args!(|args| { + ::std::logging::log(lvl, args) + }, \"{}\", fmt!($($arg),+)) } }) ) @@ -834,7 +838,9 @@ pub fn std_macros() -> @str { ($lvl:expr, $($arg:tt)+) => ({ let lvl = $lvl; if lvl <= __log_level() { - ::std::logging::log(lvl, format!($($arg)+)) + format_args!(|args| { + ::std::logging::log(lvl, args) + }, $($arg)+) } }) ) |
