common: add debugln macro
Add a macro to emit debug information to stderr. Omitted in release
builds. This is a first step to cleaning up the compiler output. Later
we'll want additional verbosity switches that can toggle certain
diagnostics on or off as required.
use source::Span;
use std::fmt;
+/// Print debug information. Omitted in release builds.
+#[macro_export]
+#[cfg(debug_assertions)]
+macro_rules! debugln {
+ ($($arg:tt)*) => { eprintln!("\x1B[34;1mdebug:\x1B[m {}", format!($($arg)*)); }
+}
+/// Print debug information. Omitted in release builds.
+#[macro_export]
+#[cfg(not(debug_assertions))]
+macro_rules! debugln {
+ ($($arg:tt)*) => {}
+}
/// A handler deals with errors.
#[derive(Debug)]
