diff options
Diffstat (limited to 'Source/CPack/cmCPackLog.h')
-rw-r--r-- | Source/CPack/cmCPackLog.h | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 7a7ff58..41871cc 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -15,24 +15,23 @@ #include "cmObject.h" -#define cmCPack_Log(ctSelf, logType, msg) \ - do { \ - std::ostringstream cmCPackLog_msg; \ - cmCPackLog_msg << msg; \ - (ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str());\ - } while ( 0 ) +#define cmCPack_Log(ctSelf, logType, msg) \ + do { \ + std::ostringstream cmCPackLog_msg; \ + cmCPackLog_msg << msg; \ + (ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str()); \ + } while (0) #ifdef cerr -# undef cerr +#undef cerr #endif #define cerr no_cerr_use_cmCPack_Log #ifdef cout -# undef cout +#undef cout #endif #define cout no_cout_use_cmCPack_Log - /** \class cmCPackLog * \brief A container for CPack generators * @@ -45,7 +44,8 @@ public: cmCPackLog(); ~cmCPackLog(); - enum __log_tags { + enum __log_tags + { NOTAG = 0, LOG_OUTPUT = 0x1, LOG_VERBOSE = 0x2, @@ -56,19 +56,19 @@ public: //! Various signatures for logging. void Log(const char* file, int line, const char* msg) - { + { this->Log(LOG_OUTPUT, file, line, msg); - } + } void Log(const char* file, int line, const char* msg, size_t length) - { + { this->Log(LOG_OUTPUT, file, line, msg, length); - } + } void Log(int tag, const char* file, int line, const char* msg) - { + { this->Log(tag, file, line, msg, strlen(msg)); - } + } void Log(int tag, const char* file, int line, const char* msg, - size_t length); + size_t length); //! Set Verbose void VerboseOn() { this->SetVerbose(true); } @@ -126,11 +126,11 @@ private: std::string WarningPrefix; std::string ErrorPrefix; - std::ostream *DefaultOutput; - std::ostream *DefaultError; + std::ostream* DefaultOutput; + std::ostream* DefaultError; std::string LogOutputFileName; - std::ostream *LogOutput; + std::ostream* LogOutput; // Do we need to cleanup log output stream bool LogOutputCleanup; }; @@ -139,13 +139,16 @@ class cmCPackLogWrite { public: cmCPackLogWrite(const char* data, size_t length) - : Data(data), Length(length) {} + : Data(data) + , Length(length) + { + } const char* Data; size_t Length; }; -inline std::ostream& operator<< (std::ostream& os, const cmCPackLogWrite& c) +inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c) { os.write(c.Data, c.Length); os.flush(); |