stapix

Yet another static page generator for photo galleries

Commit
c5ee607c7934eb80bac38146ed296578392b7e85
Parent
a929b664b10c69d7138a017ddaa701f54fc05ced
Author
Pablo <pablo-pie@riseup.net>
Date

Made the info_done! macro configurable

Also removed dead code from the logging module

Diffstat

1 file changed, 11 insertions, 42 deletions

Status File Name N° Changes Insertions Deletions
Modified src/log.rs 53 11 42
diff --git a/src/log.rs b/src/log.rs
@@ -50,14 +50,6 @@ pub(crate) fn log(level: Level, args: &Arguments<'_>, newline: bool) {
 
 #[macro_export]
 macro_rules! info {
-    // info!(key1:? = 42, key2 = true; "a {} event", "log");
-    ($($key:tt $(:$capture:tt)? $(= $value:expr)?),+; $($arg:tt)+) => ({
-        $crate::log::log(
-            $crate::log::Level::Info,
-            &std::format_args!($($arg)+),
-            false,
-        );
-    });
     // info!("a {} event", "log");
     ($($arg:tt)+) => ({
         $crate::log::log(
@@ -70,14 +62,6 @@ macro_rules! info {
 
 #[macro_export]
 macro_rules! infoln {
-    // infoln!(key1:? = 42, key2 = true; "a {} event", "log");
-    ($($key:tt $(:$capture:tt)? $(= $value:expr)?),+; $($arg:tt)+) => ({
-        $crate::log::log(
-            $crate::log::Level::Info,
-            &std::format_args!($($arg)+),
-            true,
-        );
-    });
     // infoln!("a {} event", "log");
     ($($arg:tt)+) => ({
         $crate::log::log(
@@ -90,21 +74,22 @@ macro_rules! infoln {
 
 #[macro_export]
 macro_rules! info_done {
-    () => { 
+    () => ({
         let _ = writeln!(io::stdout().lock(), " Done!");
-    };
+    });
+
+    // infoln!("a {} event", "log");
+    ($($arg:tt)+) => ({
+        let _ = writeln!(
+            io::stdout().lock(),
+            " {}",
+            &std::format_args!($($arg)+)
+        );
+    });
 }
 
 #[macro_export]
 macro_rules! error {
-    // error!(key1:? = 42, key2 = true; "a {} event", "log");
-    ($($key:tt $(:$capture:tt)? $(= $value:expr)?),+; $($arg:tt)+) => ({
-        $crate::log::log(
-            $crate::log::Level::Error,
-            &std::format_args!($($arg)+),
-            false,
-        );
-    });
     // info!("a {} event", "log");
     ($($arg:tt)+) => ({
         $crate::log::log(
@@ -117,14 +102,6 @@ macro_rules! error {
 
 #[macro_export]
 macro_rules! errorln {
-    // errorln!(key1:? = 42, key2 = true; "a {} event", "log");
-    ($($key:tt $(:$capture:tt)? $(= $value:expr)?),+; $($arg:tt)+) => ({
-        $crate::log::log(
-            $crate::log::Level::Error,
-            &std::format_args!($($arg)+),
-            true,
-        );
-    });
     // errorln!("a {} event", "log");
     ($($arg:tt)+) => ({
         $crate::log::log(
@@ -137,14 +114,6 @@ macro_rules! errorln {
 
 #[macro_export]
 macro_rules! warnln {
-    // info!(key1:? = 42, key2 = true; "a {} event", "log");
-    ($($key:tt $(:$capture:tt)? $(= $value:expr)?),+; $($arg:tt)+) => ({
-        $crate::log::log(
-            $crate::log::Level::Warn,
-            &std::format_args!($($arg)+),
-            true,
-        );
-    });
     // info!("a {} event", "log");
     ($($arg:tt)+) => ({
         $crate::log::log(