Index: ext/libicpf/src/log.h =================================================================== diff -u -re17c80d36eaa0430313e7d1058aa7a301d1510af -r338a33bbdb8c82416f0351408eea3243520784e5 --- ext/libicpf/src/log.h (.../log.h) (revision e17c80d36eaa0430313e7d1058aa7a301d1510af) +++ ext/libicpf/src/log.h (.../log.h) (revision 338a33bbdb8c82416f0351408eea3243520784e5) @@ -100,8 +100,8 @@ public: /** \name Construction/destruction */ /**@{*/ - log_file(); ///< Standard constructor - ~log_file(); ///< Standard destructor + explicit log_file(bool bGlobal=false); ///< Standard constructor + ~log_file(); ///< Standard destructor /**@}*/ /** \name Initialization */ @@ -141,6 +141,9 @@ void loge(const char_t* pszStr, ...); ///< Logs an error message with formatting void loges(const char_t* pszStr, ...); ///< Logs an error message with formatting(also prints to stderr) + + void logerr(const char_t* pszStr, int iSysErr, ...); ///< Logs an error message with system error number and error description + void logerrs(const char_t* pszStr, int iSysErr, ...); ///< Logs an error message with system error number and error description (also prints to stderr) /**@}*/ /// Gets the global instance of the log file @@ -152,16 +155,21 @@ protected: /// Truncates a log file not to exceed the max file size - bool truncate(int_t iAdd); + bool truncate(int_t iAdd) const; /// Returns the size of a log file - int_t size(); + int_t size() const; + +private: + /// Prepares a new format string for logerr(s) functions + bool prepare_fmt(const char_t* pszStr, int iSysErr, char_t* pszOut) const; -public: +protected: char_t* m_pszPath; ///< Path to the log file int_t m_iMaxSize; ///< Maximum size of the log file bool m_bLogStd; ///< Log also to stdout/stderr int_t m_iLogLevel; ///< Log level (similar to the _LOG_LEVEL, but change'able after compilation) - + bool m_bGlobal; ///< Is this the global instance of app log ? (so the LOG* macros would use it) + protected: mutex m_lock; ///< Lock for making the class thread safe };