summaryrefslogtreecommitdiff
path: root/src/debug.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug.rs')
-rw-r--r--src/debug.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/debug.rs b/src/debug.rs
new file mode 100644
index 0000000..2f7da4e
--- /dev/null
+++ b/src/debug.rs
@@ -0,0 +1,14 @@
+use std::env;
+
+pub fn debug(msg: &str) {
+ if env::var("ROR_DEBUG").unwrap_or_default() == "1" {
+ eprintln!("[DEBUG] {}", msg);
+ }
+}
+
+#[macro_export]
+macro_rules! debug {
+ ($($arg:tt)*) => {
+ $crate::debug::debug(&format!($($arg)*));
+ };
+}