Skip to content

Commit

Permalink
UniLog: __FILE_NAME__
Browse files Browse the repository at this point in the history
  • Loading branch information
fchn289 committed Aug 8, 2024
1 parent 73829cb commit cee60b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/log/UniBaseLog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down

0 comments on commit cee60b5

Please sign in to comment.