From a31d7ca48b71155590a850c7ed87749ef1579874 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 01:52:29 +0000 Subject: [PATCH] partial revert as pvs mislead me --- .../3rd/library/platform/utils/Base/AutoLog.h | 165 +++++++++--------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index daabba68..18871c7f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -6,107 +6,110 @@ #include #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { + #endif - namespace Base - { - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; +namespace Base +{ - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // constructor, no file loaded - CAutoLog(); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // constructor, no file loaded + CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // Close log file if opened. - void Close(void); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Close log file if opened. + void Close(void); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - void Archive(void); // archives current log + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + int nTodaysDayOfYear; // remember the current day to detect change of day + void Archive(void); // archives current log - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + } - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } - }; + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } + + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } +}; #ifdef EXTERNAL_DISTRO }; #endif