From 5cdc9532c2c047f5c0da7f7271ae43cfc114bb77 Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Thu, 24 May 2018 12:54:10 -0400 Subject: [PATCH] Add warn log function. To differentiate warnings from informational stuff. --- Source/Log.cpp | 12 ++++++++++++ Source/Log.h | 1 + 2 files changed, 13 insertions(+) diff --git a/Source/Log.cpp b/Source/Log.cpp index a5b3b60f..143824d8 100644 --- a/Source/Log.cpp +++ b/Source/Log.cpp @@ -27,6 +27,18 @@ void CLog::Print(const char* logName, const char* format, ...) #endif } +void CLog::Warn(const char* logName, const char* format, ...) +{ +#if defined(_DEBUG) && !defined(DISABLE_LOGGING) + auto& logStream(GetLog(logName)); + va_list args; + va_start(args, format); + vfprintf(logStream, format, args); + va_end(args); + logStream.Flush(); +#endif +} + Framework::CStdStream& CLog::GetLog(const char* logName) { auto logIterator(m_logs.find(logName)); diff --git a/Source/Log.h b/Source/Log.h index 79c9643b..6e4e15c0 100644 --- a/Source/Log.h +++ b/Source/Log.h @@ -14,6 +14,7 @@ public: virtual ~CLog() = default; void Print(const char*, const char*, ...); + void Warn(const char*, const char*, ...); private: typedef std::map LogMapType;