From 53a5ce52c5b15c227f16f8e8d3af0fdf9a208f35 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 19 Aug 2023 11:28:48 +0200 Subject: [PATCH] Implement FLOGF formatting Note: This *requires* an argument after the format string: ```rust FLOGF!(debug, "foo"); ``` won't compile. I think that's okay, because in that case you should just use FLOG. An alternative is to make it skip the sprintf. --- fish-rust/src/flog.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fish-rust/src/flog.rs b/fish-rust/src/flog.rs index a722feb3f..4e1f3ddeb 100644 --- a/fish-rust/src/flog.rs +++ b/fish-rust/src/flog.rs @@ -191,10 +191,9 @@ macro_rules! FLOG { }; } -// TODO implement. macro_rules! FLOGF { - ($category:ident, $($elem:expr),+ $(,)*) => { - crate::flog::FLOG!($category, $($elem),*); + ($category:ident, $fmt: expr, $($elem:expr),+ $(,)*) => { + crate::flog::FLOG!($category, sprintf!($fmt, $($elem),*)); } }