From ddc3e3bcfc58af4f581656d75ff1bd40c4c7d329 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 4 Jul 2024 15:27:53 -0600 Subject: [PATCH] WIP: fmt: add convenience functions Change-Id: I48f14b4e9f722485482ec7952565e79084c6f5ed --- src/libutil/fmt.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/libutil/fmt.hh b/src/libutil/fmt.hh index 0c9eeb607..515471e4c 100644 --- a/src/libutil/fmt.hh +++ b/src/libutil/fmt.hh @@ -10,11 +10,28 @@ #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED #endif #include +#include +#include #include "ansicolor.hh" namespace nix { +/// Hot sale: order now and you can get two characters off of every fmt::format() call! +template +inline auto fmtformat(fmt::format_string format, Args && ...args) +{ + return fmt::format(format, std::forward(args)...); +} + +using fmt::println; + +template +inline void eprintln(fmt::format_string format, Args && ...args) +{ + return fmt::println(stderr, format, std::forward(args)...); +} + /** * Values wrapped in this struct are printed in magenta. *