From f99a8a0fc63d8eb404100246b31b1f6ad2e2ba44 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 9 Jun 2020 16:10:07 +0200 Subject: [PATCH] Improve homogeneity of rsdebug Offer variadic style macros also for RsInfo...RsFatal --- libretroshare/src/util/rsdebug.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/util/rsdebug.h b/libretroshare/src/util/rsdebug.h index 4a88d8c90..71645e6dc 100644 --- a/libretroshare/src/util/rsdebug.h +++ b/libretroshare/src/util/rsdebug.h @@ -148,7 +148,8 @@ RS_DBG4("Hello 4 ", "my debug ", my_variable) << " message " << variable2; * even if are not printed, due to how C++ is made it is not possible to avoid * this, so we suggest to use variadic style for debug messages. */ -using RsDbg = t_RsLogger; +using RsDbg = t_RsLogger; +#define RS_DBG(...) RsDbg(__PRETTY_FUNCTION__, " ", __VA_ARGS__) /** * Comfortable log information reporting helper, supports chaining like @@ -158,17 +159,21 @@ using RsDbg = t_RsLogger; RsInfo() << __PRETTY_FUNCTION__ << "My information message" << std::cerr; @endcode */ -using RsInfo = t_RsLogger; +using RsInfo = t_RsLogger; +#define RS_INFO(...) RsInfo(__PRETTY_FUNCTION__, " ", __VA_ARGS__) /// Similar to @see RsInfo but for warning messages -using RsWarn = t_RsLogger; +using RsWarn = t_RsLogger; +#define RS_WARN(...) RsWarn(__PRETTY_FUNCTION__, " ", __VA_ARGS__) /// Similar to @see RsInfo but for error messages -using RsErr = t_RsLogger; +using RsErr = t_RsLogger; +#define RS_ERR(...) RsErr(__PRETTY_FUNCTION__, " ", __VA_ARGS__) /** Similar to @see RsInfo but for fatal errors (the ones which cause RetroShare * to terminate) messages */ -using RsFatal = t_RsLogger; +using RsFatal = t_RsLogger; +#define RS_FATAL(...) RsFatal(__PRETTY_FUNCTION__, " ", __VA_ARGS__) /**