From 757231cc6e777b8f4717d1467ef7efa01c7fde15 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 3 Jan 2018 17:41:16 +0000 Subject: Add the fmt library (#4065) * Replaces AppendVPrintf with fmt::sprintf * fmt::ArgList now used as a type safe alternative to varargs. * Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu. * Adds FLOG functions to log with fmt's native formatting style. --- src/Logger.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/Logger.h') diff --git a/src/Logger.h b/src/Logger.h index b4bf97cd6..14c02d825 100644 --- a/src/Logger.h +++ b/src/Logger.h @@ -58,7 +58,13 @@ public: cAttachment(cListener * a_listener) : m_listener(a_listener) {} }; - void Log (const char * a_Format, eLogLevel a_LogLevel, va_list a_ArgList) FORMATSTRING(2, 0); + /** Log a message formatted with a printf style formatting string. */ + void LogPrintf(const char * a_Format, eLogLevel a_LogLevel, fmt::ArgList a_ArgList); + FMT_VARIADIC(void, LogPrintf, const char *, eLogLevel) + + /** Log a message formatted with a python style formatting string. */ + void LogFormat(const char * a_Format, eLogLevel a_LogLevel, fmt::ArgList a_ArgList); + FMT_VARIADIC(void, LogFormat, const char *, eLogLevel) /** Logs the simple text message at the specified log level. */ void LogSimple(AString a_Message, eLogLevel a_LogLevel = llRegular); @@ -79,12 +85,3 @@ private: - -// These declarations are duplicated in globals.h -extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGWARNING(const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGERROR (const char * a_Format, ...) FORMATSTRING(1, 2); - - - -- cgit v1.2.3