From cee60b5fe93ed3c1f346c14f91710f3e26ddd26f Mon Sep 17 00:00:00 2001 From: fchn289 Date: Thu, 8 Aug 2024 08:56:59 +0800 Subject: [PATCH] UniLog: __FILE_NAME__ --- src/log/UniBaseLog.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/log/UniBaseLog.hpp b/src/log/UniBaseLog.hpp index 2f3f955..986f6e0 100644 --- a/src/log/UniBaseLog.hpp +++ b/src/log/UniBaseLog.hpp @@ -19,8 +19,12 @@ using LogName = std::string; // *********************************************************************************************** // - mem safe: yes -// - MT safe : yes upon UniCoutLog, no upon UniSmartLog -#define BUF(content) __func__ << "():" << __LINE__ << ": " << content << std::endl // __FILE_NAME__ since GCC 12 +// - MT safe : yes of UniCoutLog, no of UniSmartLog +#ifdef __FILE_NAME__ // g++12/c++20 +#define BUF(content) __FILE_NAME__ << ':' << __func__ << "():" << __LINE__ << ": " << content << std::endl +#else +#define BUF(content) __func__ << "():" << __LINE__ << ": " << content << std::endl +#endif #define INF(content) { oneLog() << "INF] " << BUF(content); } #define WRN(content) { oneLog() << "WRN] " << BUF(content); } #define ERR(content) { oneLog() << "ERR] " << BUF(content); }