Removed old logging system.
This commit is contained in:
		| @@ -83,13 +83,15 @@ freely, subject to the following restrictions: | ||||
| 		{ \ | ||||
| 			if (!(condition)) \ | ||||
| 			{ \ | ||||
| 				PolyVox::logFatal() << "\n"; \ | ||||
| 				PolyVox::logFatal() << "    PolyVox Assertion Failed!"; \ | ||||
| 				PolyVox::logFatal() << "    ========================="; \ | ||||
| 				PolyVox::logFatal() << "    Condition: " << #condition; \ | ||||
| 				PolyVox::logFatal() << "    Message:   " << (message); \ | ||||
| 				PolyVox::logFatal() << "    Location:  " << "Line " << __LINE__ << " of " << __FILE__; \ | ||||
| 				PolyVox::logFatal() << "\n"; \ | ||||
| 				std::stringstream ss; \ | ||||
| 				ss << "\n"; \ | ||||
| 				ss << "    PolyVox Assertion Failed!"; \ | ||||
| 				ss << "    ========================="; \ | ||||
| 				ss << "    Condition: " << #condition; \ | ||||
| 				ss << "    Message:   " << (message); \ | ||||
| 				ss << "    Location:  " << "Line " << __LINE__ << " of " << __FILE__; \ | ||||
| 				ss << "\n"; \ | ||||
| 				PolyVox::Impl::getLoggerInstance()->logFatalMessage(ss.str()); \ | ||||
| 				POLYVOX_HALT(); \ | ||||
| 			} \ | ||||
| 		} while(0) \ | ||||
| @@ -154,8 +156,10 @@ freely, subject to the following restrictions: | ||||
| 		{ \ | ||||
| 			if ((condition)) \ | ||||
| 			{ \ | ||||
| 				PolyVox::logError() << (message); \ | ||||
| 				throw type((message)); \ | ||||
| 				std::stringstream ss; \ | ||||
| 				ss << message; \ | ||||
| 				PolyVox::Impl::getLoggerInstance()->logErrorMessage(ss.str()); \ | ||||
| 				throw type(ss.str()); \ | ||||
| 			} \ | ||||
| 		} while(0) \ | ||||
| 		POLYVOX_MSC_WARNING_POP | ||||
| @@ -168,8 +172,10 @@ freely, subject to the following restrictions: | ||||
| 		POLYVOX_DISABLE_MSC_WARNING(4127) \ | ||||
| 		do \ | ||||
| 		{ \ | ||||
| 			PolyVox::logError() << (message); \ | ||||
| 			throw type((message)); \ | ||||
| 			std::stringstream ss; \ | ||||
| 			ss << message; \ | ||||
| 			PolyVox::Impl::getLoggerInstance()->logErrorMessage(ss.str()); \ | ||||
| 			throw type(ss.str()); \ | ||||
| 		} while(0) \ | ||||
| 		POLYVOX_MSC_WARNING_POP | ||||
|  | ||||
| @@ -192,8 +198,10 @@ freely, subject to the following restrictions: | ||||
| 		{ \ | ||||
| 			if ((condition)) \ | ||||
| 			{ \ | ||||
| 				PolyVox::logError() << (message); \ | ||||
| 				type except = (type)((message)); \ | ||||
| 				std::stringstream ss; \ | ||||
| 				ss << message; \ | ||||
| 				PolyVox::Impl::getLoggerInstance()->logErrorMessage(ss.str()); \ | ||||
| 				type except = (type)(ss.str()); \ | ||||
| 				getThrowHandler()((except), __FILE__, __LINE__); \ | ||||
| 			} \ | ||||
| 		} while(0) \ | ||||
| @@ -207,8 +215,10 @@ freely, subject to the following restrictions: | ||||
| 		POLYVOX_DISABLE_MSC_WARNING(4127) \ | ||||
| 		do \ | ||||
| 		{ \ | ||||
| 			PolyVox::logError() << (message); \ | ||||
| 			type except = (type)((message)); \ | ||||
| 			std::stringstream ss; \ | ||||
| 			ss << message; \ | ||||
| 			PolyVox::Impl::getLoggerInstance()->logErrorMessage(ss.str()); \ | ||||
| 			type except = (type)(ss.str()); \ | ||||
| 			getThrowHandler()((except), __FILE__, __LINE__); \ | ||||
| 		} while(0) \ | ||||
| 		POLYVOX_MSC_WARNING_POP | ||||
|   | ||||
| @@ -74,112 +74,6 @@ namespace PolyVox | ||||
| 	} | ||||
|  | ||||
| 	void setLogger(Logger* pLogger); | ||||
|  | ||||
| 	namespace Impl | ||||
| 	{ | ||||
| 		std::ostream*& getTraceStreamInstance(); | ||||
| 		std::ostream*& getDebugStreamInstance(); | ||||
| 		std::ostream*& getInfoStreamInstance(); | ||||
| 		std::ostream*& getWarningStreamInstance(); | ||||
| 		std::ostream*& getErrorStreamInstance(); | ||||
| 		std::ostream*& getFatalStreamInstance(); | ||||
| 	} | ||||
|  | ||||
| 	/// Get a stream which will consume all input without outputting anything. | ||||
| 	std::ostream* getNullStream(void); | ||||
|  | ||||
| 	// These take pointers rather than references to emphasise that the  | ||||
| 	// user needs to keep the target alive as long as PolyVox is writing data. | ||||
| 	void setTraceStream(std::ostream* pStream); | ||||
| 	void setDebugStream(std::ostream* pStream); | ||||
| 	void setInfoStream(std::ostream* pStream); | ||||
| 	void setWarningStream(std::ostream* pStream); | ||||
| 	void setErrorStream(std::ostream* pStream); | ||||
| 	void setFatalStream(std::ostream* pStream); | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logTrace | ||||
| 	{ | ||||
| 		logTrace(){} | ||||
| 		~logTrace(){*(Impl::getTraceStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logTrace &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getTraceStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logDebug | ||||
| 	{ | ||||
| 		logDebug(){} | ||||
| 		~logDebug(){*(Impl::getDebugStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logDebug &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getDebugStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logInfo | ||||
| 	{ | ||||
| 		logInfo(){} | ||||
| 		~logInfo(){*(Impl::getInfoStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logInfo &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getInfoStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logWarning | ||||
| 	{ | ||||
| 		logWarning(){} | ||||
| 		~logWarning(){*(Impl::getWarningStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logWarning &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getWarningStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logError | ||||
| 	{ | ||||
| 		logError(){} | ||||
| 		~logError(){*(Impl::getErrorStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logError &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getErrorStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| 	// Automatically appending 'std::endl' as described here: http://stackoverflow.com/a/2179782 | ||||
| 	struct logFatal | ||||
| 	{ | ||||
| 		logFatal(){} | ||||
| 		~logFatal(){*(Impl::getFatalStreamInstance()) << std::endl;} | ||||
|  | ||||
| 		template<class T> | ||||
| 		logFatal &operator<<(const T &x) | ||||
| 		{ | ||||
| 			*(Impl::getFatalStreamInstance()) << x; | ||||
| 			return *this; | ||||
| 		} | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| #ifdef POLYVOX_LOG_TRACE_ENABLED | ||||
|   | ||||
		Reference in New Issue
	
	Block a user