summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-13 10:40:07 -0700
committerbors <bors@rust-lang.org>2013-03-13 10:40:07 -0700
commit695e9fd13cd71c87e9afc0903b3fb6856452d345 (patch)
tree5c97280a8ddc0e2a797912c4b3007461841d1a74 /src/libsyntax/ext
parent0ad3a110be9070b87ecd7e1c71d20a02660d8959 (diff)
parent9c7e16e48d15b3380cc680f6194fe3516867d2db (diff)
downloadrust-695e9fd13cd71c87e9afc0903b3fb6856452d345.tar.gz
rust-695e9fd13cd71c87e9afc0903b3fb6856452d345.zip
auto merge of #5293 : brson/rust/logging, r=brson
r? @graydon

This removes `log` from the language. Because we can't quite implement it as a syntax extension (probably need globals at the least) it simply renames the keyword to `__log` and hides it behind macros.

After this the only way to log is with `debug!`, `info!`, etc. I figure that if there is demand for `log!` we can add it back later.

I am not sure that we ever agreed on this course of action, though I *think* there is consensus that `log` shouldn't be a statement.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/expand.rs16
-rw-r--r--src/libsyntax/ext/fmt.rs21
2 files changed, 18 insertions, 19 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index e61e8a1a594..831d1140a53 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -411,34 +411,34 @@ pub fn core_macros() -> ~str {
 
     macro_rules! error (
         ($arg:expr) => (
-            log(::core::error, fmt!( \"%?\", $arg ))
+            __log(1u32, fmt!( \"%?\", $arg ))
         );
         ($( $arg:expr ),+) => (
-            log(::core::error, fmt!( $($arg),+ ))
+            __log(1u32, fmt!( $($arg),+ ))
         )
     )
     macro_rules! warn (
         ($arg:expr) => (
-            log(::core::warn, fmt!( \"%?\", $arg ))
+            __log(2u32, fmt!( \"%?\", $arg ))
         );
         ($( $arg:expr ),+) => (
-            log(::core::warn, fmt!( $($arg),+ ))
+            __log(2u32, fmt!( $($arg),+ ))
         )
     )
     macro_rules! info (
         ($arg:expr) => (
-            log(::core::info, fmt!( \"%?\", $arg ))
+            __log(3u32, fmt!( \"%?\", $arg ))
         );
         ($( $arg:expr ),+) => (
-            log(::core::info, fmt!( $($arg),+ ))
+            __log(3u32, fmt!( $($arg),+ ))
         )
     )
     macro_rules! debug (
         ($arg:expr) => (
-            log(::core::debug, fmt!( \"%?\", $arg ))
+            __log(4u32, fmt!( \"%?\", $arg ))
         );
         ($( $arg:expr ),+) => (
-            log(::core::debug, fmt!( $($arg),+ ))
+            __log(4u32, fmt!( $($arg),+ ))
         )
     )
 
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index af558e6b330..ee0de9e48db 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -37,8 +37,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
         expr_to_str(cx, args[0],
                     ~"first argument to fmt! must be a string literal.");
     let fmtspan = args[0].span;
-    debug!("Format string:");
-    log(debug, fmt);
+    debug!("Format string: %s", fmt);
     fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
         cx.span_fatal(sp, msg);
     }
@@ -223,7 +222,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
     }
     fn log_conv(c: Conv) {
         match c.param {
-          Some(p) => { log(debug, ~"param: " + p.to_str()); }
+          Some(p) => { debug!("param: %s", p.to_str()); }
           _ => debug!("param: none")
         }
         for c.flags.each |f| {
@@ -236,18 +235,18 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
             }
         }
         match c.width {
-          CountIs(i) => log(
-              debug, ~"width: count is " + i.to_str()),
-          CountIsParam(i) => log(
-              debug, ~"width: count is param " + i.to_str()),
+          CountIs(i) =>
+              debug!("width: count is %s", i.to_str()),
+          CountIsParam(i) =>
+              debug!("width: count is param %s", i.to_str()),
           CountIsNextParam => debug!("width: count is next param"),
           CountImplied => debug!("width: count is implied")
         }
         match c.precision {
-          CountIs(i) => log(
-              debug, ~"prec: count is " + i.to_str()),
-          CountIsParam(i) => log(
-              debug, ~"prec: count is param " + i.to_str()),
+          CountIs(i) =>
+              debug!("prec: count is %s", i.to_str()),
+          CountIsParam(i) =>
+              debug!("prec: count is param %s", i.to_str()),
           CountIsNextParam => debug!("prec: count is next param"),
           CountImplied => debug!("prec: count is implied")
         }