00001 /******************************************************************************* 00002 Copyright (c) 2005-2009 David Williams 00003 00004 This software is provided 'as-is', without any express or implied 00005 warranty. In no event will the authors be held liable for any damages 00006 arising from the use of this software. 00007 00008 Permission is granted to anyone to use this software for any purpose, 00009 including commercial applications, and to alter it and redistribute it 00010 freely, subject to the following restrictions: 00011 00012 1. The origin of this software must not be misrepresented; you must not 00013 claim that you wrote the original software. If you use this software 00014 in a product, an acknowledgment in the product documentation would be 00015 appreciated but is not required. 00016 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 00020 3. This notice may not be removed or altered from any source 00021 distribution. 00022 *******************************************************************************/ 00023 00024 #ifndef __PolyVox_Log_H__ 00025 #define __PolyVox_Log_H__ 00026 00027 #include "PolyVoxImpl/TypeDef.h" 00028 00029 #include <string> 00030 00031 //Note: The functions in this file are not for the user to call - they are 00032 //intended for internal use only. The only exception is that you may set the 00033 //logHandler pointer to point at your own handling funtion for printing, etc. 00034 00035 namespace PolyVox 00036 { 00040 enum LogSeverity 00041 { 00042 LS_DEBUG, 00043 LS_INFO, 00044 LS_WARN, 00045 LS_ERROR 00046 }; 00047 00048 POLYVOX_API extern void (*logHandler)(std::string, int severity); 00049 } 00050 00051 //Debug severity messages are only used if we are a debug build 00052 #ifdef _DEBUG 00053 #define POLYVOX_LOG_DEBUG(message) if(logHandler){logHandler(message, LS_DEBUG);} 00054 #else 00055 #define POLYVOX_LOG_DEBUG(message) 00056 #endif 00057 00058 //Other severity levels work in both debug and release 00059 #define POLYVOX_LOG_INFO(message) if(logHandler){logHandler(message, LS_INFO);} 00060 #define POLYVOX_LOG_WARN(message) if(logHandler){logHandler(message, LS_WARN);} 00061 #define POLYVOX_LOG_ERROR(message) if(logHandler){logHandler(message, LS_ERROR);} 00062 00063 #endif